Row filter table by useremail() except Admin

I would in my table create a security filter by useremail but that this rule will not applied to the admins.

how could i proceed with the expression?

 

 

Solved Solved
0 9 96
1 ACCEPTED SOLUTION

It works, there is no doubt about that 🙂

The best option for you is to have a real user available (could be you if you have two emails?) for testing this specifically.

View solution in original post

9 REPLIES 9

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Espegg 

Please try the following:

OR(
  USEREMAIL()=[email],
  USERROLE()="Admin"
)

 Alternatively, if you plan to manage your users through a table:

OR(
  USEREMAIL()=[email],
  LOOKUP(USEREMAIL(),"USER","email","role")="Administrator"
)

 For reference:

Limit users to their own data - AppSheet Help

USERROLE() - AppSheet Help

OR() - AppSheet Help

 

Hi @Aurelien 
i have tried with 
OR( USEREMAIL()=[email], USERROLE()="Admin" )
but the users see all the records...

Why?

Hi @Espegg 

In the security filter? that should not happen, unless the user tested actually is an "admin".

Please note the preview pane always consider you an admin, no matter the email you enter in it.

Can you check and provide a screenshot of your table columns and the security filter expression you entered? Thanks

Look here @Aurelien 

Espegg_0-1712812021801.png

 



Here's the answer 🙂


@Aurelien wrote:

Please note the preview pane always consider you an admin, no matter the email you enter in it.


Aurelien_0-1712812257414.png

From the editor's preview pane, USERROLE() always renders TRUE 🙂

Ok, so there is not a way to test if it works for the normal users?

It works, there is no doubt about that 🙂

The best option for you is to have a real user available (could be you if you have two emails?) for testing this specifically.

ok, thanks!

You are welcome 🙂

Top Labels in this Space