The ActiveReports Server installation includes a security provider sample that you can find in:
C:\ActiveReports 11 Server\SDK\Samples\ActiveTunes.SecurityProvider
To open the solution, double-click the ActiveTunes.SecurityProvider.sln file.
This sample comes with an SQLite database (ActiveTunes.sqlite), which has Customer and Employee tables. The sample demonstrates how you can log in to ActiveReports Server with the user information saved in those tables and use row-level security.
Note: By default, users from the Customer table have the ActiveTunesCustomer role and users from the Employee table have the ActiveTunesEmployee role. To enable the setting, you should create the ActiveTunesCustomer and ActiveTunesEmployee roles on the Administrator Dashboard in advance.
To compile and use the Security Provider sample
- With the sample open in Visual Studio, from the Build menu, select Build Solution.
- In Windows Explorer, open the following folder, and copy the ActiveTunes.SecurityProvider.dll assembly.
C:\ActiveReports 11 Server\SDK\Samples\ActiveTunes.SecurityProvider\ActiveTunes.SecurityProvider\bin\Debug
- Paste the assembly into the following folder in your ActiveReports 11 Server installation folder.
C:\ActiveReports 11 Server\SecurityProviders
- On the Administrator Dashboard, in the Configuration section, click Security Provider.
- From the Custom security provider drop-down that appears, select ActiveTunesSecurityProviderFactory.
- In the ConnectionString property that appears, enter the connection string:
ConnectionString |
Copy Code
|
Data Source=C:\ActiveReports 11 Server\SDK\Samples\ActiveTunes.SecurityProvider\ActiveTunes.sqlite
|
- To test the custom security provider, in the Login to test and Password to test boxes, enter test values from the table below.
Login |
Password |
andrew@chinookcorp.com |
1 |
nancy@chinookcorp.com |
2 |
jane@chinookcorp.com |
3 |
margaret@chinookcorp.com |
4 |
steve@chinookcorp.com |
5 |
michael@chinookcorp.com |
6 |
robert@chinookcorp.com |
7 |
laura@chinookcorp.com |
8 |
- Click the Test provider link to connect to the sample database and verify that the authentication is successful. You will see the following screen.
- Click the Apply changes button.
- Open the Report Portal and enter Login and Password values from the table above, e.g. nancy@chinookcorp.com and 2 as password.
- You are logged into the Report Portal as a user Nancy Edwards from the ActiveTunes security provider.
Now, when you edit the ActiveTunes sample model, you can apply either the EmployeeID or CustomerID filter to any entity.
To add row-level security to the ActiveTunes sample model
- On the Administrator Dashboard, in the Administration section, click Models.
- In the list of models that appears, next to the ActiveTunes (Sample) model, click the Edit command.
- In the model editor that appears, from the Entities list to the left, click the entity that you want to filter.
- In the workspace at the center, next to the Security Filter property, click the Add command.
- In the Edit Security Filter dialog that appears, in the box next to Filter Name, enter a name for your filter.
- Select Filter Expression, and click the ellipsis button next to the box under that label.
- In the Select Attribute dialog that appears, select the attribute to which you want to apply the filter condition, and click OK.
- To the right of the equals option, click the drop-down arrow and select UserContext.CustomerID or UserContext.EmployeeID.
- Click Apply to add the filter to the entity.
See Also