I have a users table, which maintains list of users and roles. These roles are more than one and is a enumlist.
I have a table where i store the menu structure of the app. Each menu item has roles defined.
I have created slice where i need to filter data based on user roles.
I have used below formula
and([Screen]=โMastersโ,in(any(logged_user[role]),[Roles]))
At times this doesnt work.
Please assis.
In what way doesnโt it work?
I have created few forms/views. i wish to restrict these based on roles defined for each users. i have created a table for all form/views and use deeplinks to show these. i have added the roles in this table also.
now i want to show or hide the forms based on the user roles and roles defined in the menu table.
for example.
user โRahul Barveโ can access forms assigned to โplanningโ and โproductionโ since in user master is have assigned him those two.
in the second screenshot, i have tagged forms which can be accessed by which roles.
i hope i was able to make you understand.
i have found some solution right now which is as under:
and([Screen]=โHomeโ,
IF(
COUNT(logged_user[role])=1,
CONTAINS([roles], ANY(logged_user[role])),
IF(
COUNT(logged_user[role])=2,
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2))),
IF(
COUNT(logged_user[role])=3,
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2)),
CONTAINS([roles], INDEX(logged_user[role], 3))),
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2)),
CONTAINS([roles], INDEX(logged_user[role], 3)),
CONTAINS([roles], INDEX(logged_user[role], 4))))))
)
Maybe this?
ISNOTBLANK(
INTERSECT(
logged_user[role]
[roles]
)
)
See also:
Steve I like it
I will check that and revert.
thanks.
User | Count |
---|---|
40 | |
29 | |
24 | |
24 | |
13 |