Forum Discussion
Override Row Level Security
To add more detail, I have a dynamic RLS process going on. I have three columns. Team Member, Team Manager, Regional Manager.
Every individual in the Team Table has a column with their unique user principal name in Team_Member. FOr the Team_Manager column, every persons' team manager's user principal name is listed, and for everyone they have their Regional Manager's user principal name in the Regional_Manager Column.
The RLS function had an if statement.
IF ( countrows(FILTER(ALL(Team),Regional_Manager = userprincipalname()))>0, Regional_Manager = userprincipalname(),
IF(countrows(FILTER(ALL(Team),Team_Manager = userprincipalname()))>0,Team_Manager = userprincipalname(),
Team_Member = userprincipalname())))
This was working. When I tested the roles a team manager had all their direct reports showing, Regional Managers had all their team managers and direct reports and so on.
I added a column to my Team table, called All, and it has the same value for every row, "[email protected]".
I thought maybe I could add a slicer that would override the individuals user principal name to see everything.
I added another table called Viewer, with one column, called Viewer with two values, All or Individual.
I put a slicer in my report where you had to pick one of those two values.
Then in my RLS filter I created the following dynamic
var user = if(selectedvalue(Viewer[Viewer]) = "All", "[email protected]",userprincipalname())
return
if(
countrows(filter(all(team),all = user))>0, all = user,
if(
countrows(filter(all(team),Regional_Manager = user))>0, Regional_Manager = user,
if(
countrows(filter(all(team),Team_Manager = user))>0, Team_Manager = user,
Team_Member = user)))
They dynamic filtering in RLS is working based on wether the person is a team member, manager or regional manager, but it doesn't seem to be affected at all by the slicer to override the RLS.