How can I define a new role/super user?

I would like to identify different type of users, I'm using the role for Admins and Users, then, I need to define the "SuperUsers".. 
Based on, how the rules are, the users can see only their things, the admin can see everything + do some additional actions than the users, and
the SuperUser can see everything but not do any actions assigned to the admin. 

How can I define these super users  ? 

I've added a column inside the GSheet "users" -> "SuperUser" [true, false].

I tried is to use the User Settings, but, how can I set a setting using the data coming from the GoogleSheet? 
Any suggestion please?

Thank you very much!

Solved Solved
0 5 171
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @DroidTeo 

Custom roles can be created using your 1st method.

Table Users, with a column Email and a column Permission or Role.

This way, you will use this expression wherever you need it:

LOOKUP(USEREMAIL(),"User","Email","Permission")

 This assumes you manage all of your roles using this table, and maybe keep the standard "Admin" from the app editor to an equivalent of "super-admin".

View solution in original post

5 REPLIES 5

Aurelien
Google Developer Expert
Google Developer Expert

Hi @DroidTeo 

Custom roles can be created using your 1st method.

Table Users, with a column Email and a column Permission or Role.

This way, you will use this expression wherever you need it:

LOOKUP(USEREMAIL(),"User","Email","Permission")

 This assumes you manage all of your roles using this table, and maybe keep the standard "Admin" from the app editor to an equivalent of "super-admin".

Hi @Aurelien 

Thank you!
I didn't think about the LOOKUP function.. I was trying with SELECT.. 

@Aurelien 

actually I have another question with this approach... 
I would like to add a security filter on the table users. In particular I would like to say somehting like "if the users email is inside the table the data are shown", but I receive the following message:

 

The filter expression cannot reference the table being filtered.

 

 I can understand the reason ๐Ÿ™‚  but
does it means that there is no possibilities to show the users to the super users? 

This is tricky indeed, as security filter expression cannot be evaluated within the same table.

You may be interested in horizontal scaling, here is the documentation:

Advanced techniques: Horizontal scaling - AppSheet Help

Also, I recommend this excellent post from @MultiTech that may help you as well:

How to use Security Filters to allow multiple comp... - Google Cloud Community

 

More specifically to your question, what about:

OR(
  USEREMAIL()=[Email],
  LOOKUP(USEREMAIL(),"User","Email","role")="Super-Admin"
)

This is also a really good post by @MultiTech about the usage of user tables

Current User (Slice) | How to conform your app a... - Google Cloud Community
Top Labels in this Space