Hi All,
Has anyone had to create security filters for hierarchies? I have a number of groups and need to set data visibility as follows:
Manager Group 1 (can see data of all employees in group 1)
Manager Group 2 (can see data of all employees in group 2)
Each employee will only see their own data eg. [employee] = Username()
I am just having trouble trying to get the managers setup for each group. Any solutions will get you a free round of drinks in the Netherlands
Hi Jethro,
There are a few ways you could tackle this problem - here is one. In a users table you could have the following columns;
email | group | role
employee@business.com | group 1 | employee
employee2@business.com | group 2 | employee
manager@business.com | group 1 | manager
You can then create a few slices to parse your data;
Slice 1 filter condition: Useremail() = [email] (Shows only this users info)
Slice 2: Lookup(Useremail(), table name, email, group) = [group] (Shows all info for people in the same group)
You could then give all users default access to a view based on slice 1, and then only show a view based on slice 2 if Lookup(Useremail(), table name, email, role) = โManagerโ
This is but one of many ways you could accomplish this. Feel free to jump in with more/better suggestions, team!
Hope this helps
Thanks Hayden,
Your solution is more sophisticated. I ended up making some additional views and slices to represent the 2 level hierarchy. I combined it with a solution Aleksi had posted earlier:
What I ended up with was a more hardcoded format to match our usernaming convention:
View displayed if Contains(Username(),โManager1โ)
This displays the view I need on the viewbar.
Then in the Slice I put a IF statement that checks username:
If(Contains(Username(),โManager1โ), Contains([employee],โemployee1โ,[employee]="")
This worked a treat. As long as the users being created follow the convention of how we group managers and employees it works
Thanks in advance for your response. Appreciated!
User | Count |
---|---|
43 | |
29 | |
22 | |
20 | |
15 |