Hierarchy in Security Filters

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)

  • Employee 1_1
  • Employee 1_2
  • Employee 1_3

Manager Group 2 (can see data of all employees in group 2)

  • Employee 2_1
  • Employee 2_2
  • Employee 3_3

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 :slight_smile: :joy:

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

1 Like

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 :slight_smile:

Thanks in advance for your response. Appreciated!

1 Like