Forum Discussion

Mlemmers's avatar
Mlemmers
Helper I
3 years ago
Solved

Help organizational hierarchy RLS


Hi,

 

I need some help setting up a hierarchy in RLS in PBI. In this scenario (see data below) we have Selma owning department 1 and 2. If I give her access to department 1 and 2 then she can't see all the departments below her, which she should. Klaus, for example, owns 1.1 so he should see that and everything below that. I'm going a little bit insane: I want to check whether the user logged in is the person responsible for that department and they need to see everything belonging to the departments below that as well. 

 

This article doesn't go into how to handle those cases, as the workaround here isn't enough for my scenario https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi

A similar question popped up on the forums years ago but the video referred to isn't there anymore? https://community.fabric.microsoft.com/t5/Desktop/RLS-with-org-hierarchy/m-p/1134611#M516493


Dummy data (note that Selma owns 2 departments, owner is not unique)

DepartmentParentOwneremailPathLevel 1Level 2Level 3Level 4
1nullSelma[email protected]11nullnullnull
2nullSelma[email protected]22nullnullnull
3nullBill[email protected]33nullnullnull
1.11Klaus[email protected]1|1.111.1nullnull
1.21Blair[email protected]1|1.211.2nullnull
1.1.11.1Rene[email protected]1|1.1|3.1.111.11.1.1null
2.12Katy[email protected]2|2.122.1nullnull
3.13Sue[email protected]3|3.133.1nullnull
3.1.13.1Wilmer[email protected]3|3.1|3.1.133.13.1.1null
3.1.1.13.1.1Richard[email protected]3|3.1|3.1|3.1.1.1.133.13.1.13.1.1.1
  • yes, we have a rules table that is controlled by the business. It is mostly based on ActiveDirectory but allows for overrides. That table is then matched against USERPRINCIPALNAME in the RLS rule.

5 Replies

  • Treat your access permissions as lists

     

    Selma = {1,2}

     

    Then in your RLS rules you can test against these lists

     

    Department Level 1 in {1,2} => Selma is permitted

    • Mlemmers's avatar
      Mlemmers
      Helper I

      This is on me for not mentioning it before, but an approach like that wouldn't work if I have 60 of those cases, which I have. 

      • lbendlin's avatar
        lbendlin
        Super User

        Why would that not work? We have similar implementations with hundreds of such rule sets.