Forum Discussion

imenmaiza's avatar
imenmaiza
Icon for Helper II rankHelper II
5 years ago
Solved

RLS with duplicated users assigned to different Teams

RLSHello,

I am facing a problem with RLS and I deeply need support, 

First, we have build a dashboard where we manage Teams and employees. We have applied RLS and every Team leader have access to the data of his Team. Everything worked just fine.

After a while the structure of the Teams did change, now we have employees that belong to different Teams. So, we have a duplicate Username. I have listed below an example of my table called ''User'' where I manipulate Which Team Leader sees data of which employee:
Before
Team Leader John will see data of Victoria and Team Leader Bruce will see data of Alice:

IDUserNameEmailManagerID
1John[email protected] 
2Victoria[email protected]1
3Bruce[email protected] 
4Alice[email protected]3


After
Team Leader John will see data of Victoria and Alice. Team Leader Bruce will see data of Alice:

 

IDUserNameEmailManagerID
1John[email protected] 
2Victoria[email protected]1
3Bruce[email protected] 
4Alice[email protected]3
5Alice[email protected]1


I am facing a problem in relationships between the ''User'' table above where we manipulate the level of security and the ''Teams'' table where we organize the company team structure.

Is this possible? How can I set RLS with duplicated Usernames in the User table? 

I look forward to your support,

Best Regards,

  • You can have multiple RLS rules for each user, and these rules can even contradict each other. Permissive rules will override restrictive rules.

3 Replies

    • imenmaiza's avatar
      imenmaiza
      Icon for Helper II rankHelper II

      Hello Ibendlin,
      Could you please be more precise,
      Thanks in advance for your help,

  • You can have multiple RLS rules for each user, and these rules can even contradict each other. Permissive rules will override restrictive rules.