BackPrevious Page Next PageNext

Applying RLS to a Parameter

When a parameter is bound to a DBField, you can apply a record-level security policy (RLS) of data source scope to the parameter. The security policy is specified on the DBField that is bound to the parameter. At runtime, end users will only see parameter values 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 catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports.
  2. In the Catalog Manager, expand the data source where you want to create the parameter.
  3. Right-click Security Entry in the Security node, click New Security Entry on the shortcut menu, then name the security policy CusCountry.
  4. In the Security dialog, make sure Valid RLS is checked at the bottom left.
  5. Click Add button and then select Add User to add the user John, which has the permission to view the Canada records in the Country column only.

    Set Permission for John

  6. Add another user David which has the permission to view records in the United Kingdom only.
  7. In the same data source, right-click the Parameters node and click New Parameter on the shortcut menu.
  8. In the New 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. Click OK.

    New Parameter dialog

  9. Create a query CustomersInfo on the table Customers. Select all the fields contained in the table.
  10. Create a page report with a standard banded object in it based on the query, and have the fields Customer ID, Customer Name, Country and Phone displayed in the report.
  11. In the Data panel, right-click the node that represents the query, and then select Edit Query from the shortcut menu.
  12. In the Query Editor, click Menu > Query > Filter.
  13. In the Search Condition dialog, add a condition for the query as follows (for details, see Filtering with the Filter Format):

    Add a condition in the Search Condition dialog

  14. Click OK to apply the changes to the query.
  15. Click File > Options, in the General category of the Options dialog, set the User Name as John.
  16. View the report, and the Enter Parameter Values dialog is displayed.
  17. Click the parameter value drop-down list, and you can see that only Canada is displayed for the user name.

    Enter Parameter Value dialog

  18. Set the user name as David in the Options dialog 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:

BackPrevious Page Next PageNext