Forum Discussion

mizaskun's avatar
mizaskun
Icon for Helper II rankHelper II
5 years ago

RLS multiple rol crash

Good morning,

 

As I understood, a multiple role based RLS works as a OR clause. A user will see lines granted through role A and lines granted through role B.

 

I have the following schema:

 

The table PERMISOS stores a user email and the plants to which a user have access. 

 

My frist role checks whether the loged user have access to a plant:

 

And the second role checks if the user is the owner of a control:

 

The roles work correclty by separate. I only see controls from granted plants or I only see controls of which I am the owner.

 

However, when I try to assign both roles to see the controls from which I am the owner and the controls of the plants I need to see, all the data is retrieved. I see controls that I am not owner of and not listed in the PERMISOS table.

 

Any suggestion?