Hi everyone. I'm trying to create a security filter that will filter rows depending on the user (custom) roles (Chef, Super Admin, Admin or Basique).
Super Admin should be able to see every row, Admin only Chef and Basique rows, and Chef can see only Basique rows.
This is the formula i'm using :
IF(INDEX(Current_User[Position], 1) = "Super Admin",
true,
IF(INDEX(Current_User[Position], 1) = "Admin",
and([Position] = "Chef", [Position] = "Basique"),
IF(INDEX(Current_User[Position], 1) = "Chef",
[Position] = "Basique",true)
))
This is the slice i'm using to ref the current user :
Any help is welcomed !
Solved! Go to Solution.
@dbaum wrote:In your case, likely the Current User slice is based on the Users table, in which case the Users table's security filter won't be able to reference the table's own slice.
For filtering your User table, use a Slice instead.
Change your table's security filter to directly reference the USEREMAIL function rather than referencing the Current User slice. Implement a technique based on a cloned subset of your Users table that governs which users have access to rows from the Users table beyond their own row. You can still use the Current User slice elsewhere in your app.
In my experience, the first thing to check is whether there's a circular reference in a table security filter. It's easy to end up with that in tables like org and users, and AppSheet isn't good about flagging this condition. Confirm that any rows (from the same or a different table) referenced in a security filter expression can be loaded by the app without first evaluating that security filter expression.
In your case, likely the Current User slice is based on the Users table, in which case the Users table's security filter won't be able to reference the table's own slice.
Change your table's security filter to directly reference the USEREMAIL function rather than referencing the Current User slice. Implement a technique based on a cloned subset of your Users table that governs which users have access to rows from the Users table beyond their own row. You can still use the Current User slice elsewhere in your app.
@dbaum wrote:In your case, likely the Current User slice is based on the Users table, in which case the Users table's security filter won't be able to reference the table's own slice.
For filtering your User table, use a Slice instead.
Thank you @dbaum and @MultiTech !
You're right, there a many answers in the community, i'm trying my best to find them myself and solve my problems. Most of the time I feel dumb for not finding it myself 😣
Still, thank you for helping me. Have a nice day !
@baba_sawane wrote:Most of the time I feel dumb for not finding it myself
DON"T!!!!!
--------------------------------------------------------------------------------------------
Try this: Do a search for "Current User"
So don't feel bad about not being able to find an answer
(This is 90% of the reason for starting AppSheetInsider.com; that can be a curated space of quality answers that you can trust. Literal answers, not questions or work arounds.)
User | Count |
---|---|
18 | |
13 | |
8 | |
4 | |
2 |