Reputation: 53
I'm trying to implement a row level security using the below code but it doesn't work as intended.
However, when I replaced USERPRINCIPALNAME() with the actual email address, the RLS filter works. Is there something wrong with my DAX expression which does not allow USERPRINCPALNAME() to work?
Below is the email mapping table. This is a standalone master data and will have a one to many relationship to the main table which requires row level security filtering as per the USERPRINCIPALNAME()
Upvotes: 0
Views: 127
Reputation: 1
I totally agree with @Jon that your permissions column should not be a delimited value. I think you are dealing with a case sensitivity issue,so you may need to convert both the permissions and the result of USERPRINCIPALNAME() to lowercase, to eliminating the case sensitivity.
I added TRIM to remove any leading or trailing whitespace :
[dept] =
MAXX(
FILTER(
email_mapping,
CONTAINSSTRING(
LOWER( TRIM(email_mapping[Permissions]) ),
LOWER( TRIM( USERPRINCIPALNAME() ) )
)
),
email_mapping[Dept]
)
Upvotes: 0