Some sensitive data requires strict permission control. The data displayed in a report of employees of different levels or departments is completely different. In Cognos, you can control the data in frankwork, transfomer, or report.
The following example shows how to control the permissions of the visitor account in the report, which is very convenient.
For example, in the report on the number of employees distributed by department, we hope that each manager can only see the number of employees reported to him, rather than the number of employees under other managers. To complete data-level access security settings, we need to perform the following two steps:
Step 1. design the user-related data storage structure
Access Security control is based on the data level in the data warehouse. Therefore, in the model design of the data warehouse, we must consider the relevance of login users, which must be reflected in the Star Model of the data warehouse.
The data warehouse model in this example is designed as follows:
Figure 16. Data Model
Here, "employee" is a fact table, and "department" and "location" are dimension tables. Add a managerid to the Department dimension table to identify the manager ID of the Department. This ID is also the user ID used to log on to the Cognos server, that is, the User Login ID in the enterprise Directory Server.
If you can obtain the User Login ID value in the report and use it as the filter value in the query items in the report, you can set the data access filter.
Step 2. Use the User Login ID as the filter value during report Creation
Add a filter to the query items that need to filter data in the report. In the filter, use the macro # Sq ($ account. personalinfo. username) # defined by the Cognos system to replace the id value of the User Logon system as the filter value. In this way, when a user logs on to the system to open a report, the value of this filter changes with the change of the login user, thus realizing the security control of data access in the report.
In this example, you can set a filter for the following content in the data items of the report, which limits the login user to view only the employee information reported to him:
[Department].ManagerID = #sq($account.personalInfo.userName)# |
Figure 17. Add a filter for data in report Studio
It is very convenient.