on 03-08-2022 01:52 PM - edited on 03-09-2022 09:23 AM by Tristan
This article discusses how to address some data security (row level security) use cases ensuring that the solution is scalable and handles large data sets.
Please refer to this link for overall support of security in Incorta.
An example is provided.
One or more Incorta users belong to certain groups that need to view all records. The groups can be: ExecutiveGroup (who can see everything), DirectorGroup, etc.
We get the list of team set IDs for the user by populating an external session variable ($GetTeamSets) to get the list of TEAM Set IDs for the logged in user ($user).
SELECT tst.team_set_id FROM team_memberships tm,users_vw u,team_sets_teams tst WHERE u.employee_id_c = $user AND tm.user_id = u.id and tst.team_id = tm.TEAM_ID
Get the Market by populating an internal session variable ($V_UserMarket) by using the following expression:
query(<schema>.USERS_VW.market,<schema>.USERS_VW.LOGINNAME=$user)
Create a simple table called SeeAllDepartments (loginname,access_flag) to store users who can see all departments. You can use an excel file or a database table.
Refresh the table when you add new uses to these exception groups.
Populate another internal session variable ($CheckUserInList) to check if the current user exists in the above table. Use Y or N for session variables by using the following expression:
query(lookup(<schema>.SeeAllDepartments.ACCESS_FLAG, (<schema>.SeeAllDepartments.LOGINNAME, $user))
Add a security filter to the schema table you want to secure based on the following variables:
This condition turns all records true if the user is an administrator or member of the exception groups. For other users, the condition adds an implicit condition to any query on table, so users only see records for their own teams or market.
Session variables are populated at login time from Incorta data, so security filters are as of the last refresh in Incorta.