Forum Discussion
RLS not working for only one table
- 1 year ago
I managed to solve this issue by doing a workaround because for some reason RLS doesn't seem to work with bidirectional many-to-many relationships. That was the problem. So to "solve" this, I needed to create a bridge table with two columns: one for the distinct ID that would relate to all the other tables, and another for the RLS Code. Then I applied RLS only to this bridge table, and it worked.
A couple things to check:
-Relationships between TableE and the _UserManagement Table (If applicable)
-make sure you have this rule applied to the right table
Another question, is the second half of your IF statement supposed to be the start of another IF? Not sure the purpose of that second statement without more context.
- nok1 year agoAdvocate II
Hi d_m_LNK . Thanks for the reply!
I don't have any relationship between Table_E and _UserManagement. In fact, _UserManagement doesn't have a relationship with any table in my report.
All "communication" between _UserManagement and my other tables is done directly in the RLS code.
And the purpose of the second part of my IF is that if a user is not of the Admin type, the report should only show him the data where the value in RLS_AccessCode column is the same as the table created in the _Permissions variable.- d_m_LNK1 year agoSuper User
So you might consider nesting another If statement in that so it returns true but that might not be the issue. You could also converting the IF statement to a Switch(TRUE()) statement that way you can control what each check will return.
The way I've applied RLS in my org was to create dimension tables with the folks that need access and making sure there is a correlating ID on the fact table of the model to relate to. That way you apply the RLS to the dimensions and that filters out the rows in the fact that meet the criteria you need.
In your case, your user management table could be a dimension as long as you could categorize whatever fact you are using by access code or create a bridge table to translate what that filter would ultimately look like.