Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

RLS using an if(switch)-statement and an or-statement

Hi,   I am trying to configure Row-Level Security for my model but it does not work the way I want it to.   My main table is the "Quotes" table with a lot of specific details about agreements for...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    4 years ago

    Hi, Anonymous 

     

    I think you don't understand enough about the nature of RLS. Since your main table doesn't have an email column, you can only get row and column data through relational matching. If it doesn't match, you can get nothing, not get all.

     

    So what you have to do is to build a new role to separate those who can see the whole report from those who can see some of the reports.

    Below is my sample:

    Copy the user table and rename it to distinguish from and to, and then establish a relationship with the main table respectively. 

    Set rls roles in desktop.

    Deploy permissions in the service. 

    Note that you need to create two groups to avoid conflicts, put users who see all reports in one group and add them to All roles. Put the users who can only see some of them in another group, and then add them to From and To roles, both roles must be added, otherwise they will not see all of they can see.

    I have tested this method and it works fine.

     

    Did I answer your question? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.

    Best Regards,
    Community Support Team _ Janey