Forum Discussion
gsk135
1 year agoRegular Visitor
Override RLS
I have a table which has a region field. I created a table as access with username, region, useradmin. I want to filter region on main table based on the username and region from access table. U...
- 1 year ago
Hi gsk135
Assign something like as the filter on your security table
SWITCH(TRUE(),USERNAME() IN VALUES(Security[User]) //if the username is in the security table,Security[User] = USERNAME() //filter to that user,USERNAME() = "Admin" //if the user is admin return true i.e all data,TRUE())To test click Modelling | View As then under Other user enter the name to test. Also tick the security role you created here mine is untitled
SamWiseOwl
1 year agoSuper User
Hi gsk135
Assign something like as the filter on your security table
SWITCH(
TRUE()
,USERNAME() IN VALUES(Security[User]) //if the username is in the security table
,Security[User] = USERNAME() //filter to that user
,USERNAME() = "Admin" //if the user is admin return true i.e all data
,TRUE()
)
To test click Modelling | View As then under Other user enter the name to test. Also tick the security role you created here mine is untitled