When you work with data services, you can control access to sensitive data for specific user roles. This facility is called Role-based content filtering. It filters data where specific data sections are only accessible to a given type of users.
To use this feature, it is necessary to ensure that the data service is secured with a UT policy. Note that you need to use WSO2 EI tooling to apply security policies to a data service. Therefore, if you have already created the data service using the management console as explained below, import your data service file to the tool and apply the UT security policy.
See the instructions on using WSO2 EI Tooling to develop data services.
Follow the steps below to filter a data service according to a specific user role.
- Log on to the management console and select Services > List under the Main menu.
- The Deployed Services window appears, which lists out all the currently active services and service groups. Click the data service you want to edit to open its dashboard.
- In the dashboard, click the Edit Data Service link.
You can directly edit the XML file or use the management console. We use the latter in this example.
- Navigate to the Queries page of the data service, select the query you want to edit and Edit Query.
- In the Output Mappings section of the query, edit the field that needs to be filtered and tick the appropriate user role in the Allowed User Roles section.
- Once all the required roles are set, the result entries of the Edit Query page look as follows in this example:
- Save the changes.