Forum Discussion

fbackes's avatar
fbackes
Helper I
6 years ago

Multiple roles for one user

Hello everyone

I have defined two roles, which restrict access in two different dimensions respectively. E.g. 2017 in the time dimension and the customer 'XYZ' in the customer dimension.

When I selected both in 'View as Roles' I expected to see only the intersection (and logic of both conditions of both roles) of restricted sets, for example, only customer data 'XYZ' in 2017. Instead, I saw all the data.

How do multiple roles work for a user in general?

5 Replies

    • parry2k's avatar
      parry2k
      Super User

      fbackes I have few blog post on RLS, check it here and there is one how you implement your business logic in RLS, hope it helps to implement your RLS logic.

       

      I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

      • LowerB's avatar
        LowerB
        Regular Visitor

        Thanks a lot, parry2k 

        Your blog looks quite interesting! I will give it a deeper look. 

        All the best
        Frank

         

    • LowerB's avatar
      LowerB
      Regular Visitor

      Many thanks for your answer nandukrishnavs 

      >Create a single role and add multiple filter conditions inside that.

       

      This is exactly what I finally did, but having multiple roles would be more elegant and easier to maintain, IMHO.


      All the best
      Frank

       

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, fbackes 

     

    If you set two rules in two roles, the result will be the data filtered by rule one as well as the data filtered by rule two. If you want to get the intersection of two rules, you need to put two rules into one role with a "&&". I created data to reproduce your scenario.

    Table:

    Two rules in two roles:

     

    CompanyLevel: [Company] = "C1"
    DepartmentLevel: [Department] = "A"

     

     

     

    Two rules in one role:

     

    Conpamy&Department: [Department] = "A" && [Company] = "C1"

     

     

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.