Applying RLS to a parameter

When a parameter is bound with another column, you can apply a record-level security policy (RLS) in the data source, which is defined on the bound column, to the parameter, then at runtime, end users will only see data which the security identifier allows to view in the parameter value drop-down list.

The following example explains how to apply RLS to the value drop-down list of a parameter in detail.

  1. Open the demo catalog SampleReports.cat and in the Catalog Browser, expand the data source where to create the parameter.
  2. Right-click Security Entry in the Security node and then click Add Security Entry.
  3. Name the security policy CusCountry and in the Security dialog check Valid RLS.
  4. Click and then select Add User to add the user John, which has the permission to view the Canada records in the Country column only.

  5. Add another user David which has the permission to view records in the United Kingdom only.

    For details about how to set up a RLS policy, refer to Setting up a connection-scope security policy.

  6. In the same data source, right-click the Parameters node and then click Add Parameter.
  7. In the Create Parameter dialog, enter pCountry in the Name field, select Bind with Single Column from the Value Setting drop-down list, and bind the parameter with the Country column. In the Options box, select CusCountry as value of Record Level Security, and then set the Distinct option to true.
  8. Create a query CustomersInfo on the table Customers. Select all the fields contained in the table.
  9. Create a standard banded report based on the query, and have the fields Customer ID, Customer Name, Country and Phone displayed in the report.
  10. In the Resource View panel, right-click the node that represents the query, and then select Edit Query from the shortcut menu.
  11. In the Query Editor, click Query > Filter.
  12. In the Search Condition dialog, add a condition for the query as follows (for details, see Filtering with the filter format):

  13. Click OK to apply the changes to the query.
  14. Click File > Options on the menu bar, in the General category of the Options dialog, set the User Name as John.
  15. View the report, and the Enter Parameter Values dialog is displayed.
  16. Click the parameter value drop-down list, and you can see that only Canada is displayed for the user name.
  17. Set the user name as David this time and view the report again. You will find that only the value United Kingdom is displayed in the parameter value drop-down list this time.

Notes: