My app have 4 roles: Admin, Vendor, Manager, Employee
I feel incredibly stupid. I have been trying to find out why all of a sudden, the Admin role currently functions like an Employee. This is the expression I put into the Security filter, pretty much copied from this: https://youtu.be/2Z2qUTtxNFA?t=1677
IFS(
OR(
ANY(Current_User[Role])=“Admin”,
ANY(Current_User[Role])=“Vendor”
),
TRUE,
ANY(Current_User[Role])=“Manager”,
OR(
[User_Email]=USEREMAIL(),
AND(
[User_Email].[Management]=ANY(Current_User[Management]),
[User_Email].[Role]=“Manager”
[User_Email].[Role]=“Employee”
)
),
TRUE,
[User_Email]=USEREMAIL()
)
I’ve tried troubleshooting the following:
- If I take away the entire security filter, all roles work like it did before I applied the filter. So I believe the issue is in the security filter.
- Tested that the vendor role works as intended with the filter, since it’s pretty much identical to the Admin line.
- Tried replacing the role “Admin” with “Super Admin,” just in case I somehow restricted the Admin role somewhere in the app. Super Admin worked like faulty Admin/ Employee role.
- If I take away “ANY(Current_User[Role])=“Admin”,”, nothing noticeable has changed, which leads me to think that it’s functioning according to this line: “TRUE, [User_Email]=USEREMAIL()”
I am baffled because it seems very straight forward, and I’ve combed through the syntax.
EDIT: Solved Bonus Question
Bonus Question:
So I want to make it so that Managers can see other Managers’ orders. It works in this code if I leave out “,” in the expression:
AND(
[User_Email].[Management]=ANY(Current_User[Management]),
[User_Email].[Role]=“Manager”
[User_Email].[Role]=“Employee”
)
But if I add “,” after “[User_Email].[Role]=“Manager””, then it suddenly doesn’t show ANY Manager orders and only Employee orders. I’m glad I can get it to work. But I don’t understand how. If someone don’t mind taking the time to explain, I would like to know.