0
votes

I'm about to implement dynamic row level security in my model.

If a loged user exists in my dimension, he can only see his data, if user does not exits in my dimension, than he can see everything.

Works perfect in SSAS Tabular.

DAX code frm my SSAS Tabular model which is implemented in Roles -> Row filter on dimension DimBrugerRettigheder -> DAX :

=IF(CONTAINS(DimBrugerRettigheder, [original_login], USERNAME()), DimBrugerRettigheder[original_login] = USERNAME(), TRUE())

Multidimensional data model is almost identical as my Tabular model.

Just need to translate the code in MDX

MDX code is goint to be implementet in role -> dimension data -> dimension DimBrugerRettigheder -> Advanced -> Allowed member set: -> Edit MDX

1

1 Answers

0
votes

I understand the meaning of your code is "if the name of the current user is not contained in column (in DAX, in MDX this would be attribute) 'original_login', then give access to all rows, otherwise, give access to only the rows where the column/attribute has the username as its content.

I would translate that to MDX as follows:

IIf(IsError(StrToMember('[DimBrugerRettigheder].[original_login].[' + UserName + ']')),
    [DimBrugerRettigheder].[original_login].[original_login].Members,
    {StrToMember('[DimBrugerRettigheder].[original_login].[' + UserName + ']')}
   )

In essence, if there is no valid member for the current Username in attribute [DimBrugerRettigheder].[original_login], then all members are the allowed members set, otherwise, just this single member is the only member of the allowed members set.