Forum Discussion
RLS using an if(switch)-statement and an or-statement
- 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
Hi luuksommers,
Are you over-complicating this? Could you create 2 RLS roles, one for users in the company filter and one for users that can see everything?
I have a sample file here using a bridging table and 2 roles that works as you describe, let me know if you would like a copy.
Thank you