Good way to allow users to build their own user roles

I need my users to be able to control the app roles themselves. In other words, I do not want to keep giving permissions per user. Once i give the app to my users - they will be able to add users as needed and give roles to them. Is that possible?

Solved Solved
0 5 211
1 ACCEPTED SOLUTION

@Tiger
Something like this…


ROLES TABLE


Column Name Column Type Base Type Key? Initial Value App Formula Valid_If Suggested Values Input Mode
USERROLE Enum Text - - ={“Owner” , “Superadmin” , “Admin” , “User”} - Buttons
ACCESS TYPES Enumlist Text - - - =SWITCH([USERROLE],“Owner”,{“ALL_CHANGES”},“Superadmin”,{“ADDS_AND_UPDATES” , “ADDS_AND_DELETES” , “UPDATES_AND_DELETES” , “ALL_CHANGES”},“Admin”,{“ADDS_ONLY” , “UPDATES_ONLY” , “DELETES_ONLY” , “ADDS_AND_UPDATES” , “ADDS_AND_DELETES” , “UPDATES_AND_DELETES”},{“ADDS_ONLY” , “UPDATES_ONLY” , “ADDS_AND_UPDATES”})

USERS TABLE


Column Name Column Type Base Type Key? Initial Value App Formula Valid_If Suggested Values Input Mode Source Table isPartOf?
USER_ID Text - =UNIQUEID() - - - - - -
FIRST NAME Text - - - - - - - - -
LAST NAME Text - - - - - - - - -
USEREMAIL Email - - - - - - - - -
USERROLE Ref - - - - - - Buttons ROLES -
PRIVILEGES Text - - - =[USERROLE].[ACCESS_TYPES] - - - - -

TABLE UPDATE MODE


LOOKUP(USEREMAIL(),"USERS","USEREMAIL","PRIVILEGES")

View solution in original post

5 REPLIES 5

In a way it’s possible (from access privileges perspective only. As you are an account holder, you need to whitelist each user email via AppSheet Editor’s Users Interface) if and only if you preset/predefine which userset can give/distribute which access privilege. Otherwise the app data will totally be out control.

Good point! I was going to go through each view, button etc and give permissions based on my user role table.

@Tiger
Something like this…


ROLES TABLE


Column Name Column Type Base Type Key? Initial Value App Formula Valid_If Suggested Values Input Mode
USERROLE Enum Text - - ={“Owner” , “Superadmin” , “Admin” , “User”} - Buttons
ACCESS TYPES Enumlist Text - - - =SWITCH([USERROLE],“Owner”,{“ALL_CHANGES”},“Superadmin”,{“ADDS_AND_UPDATES” , “ADDS_AND_DELETES” , “UPDATES_AND_DELETES” , “ALL_CHANGES”},“Admin”,{“ADDS_ONLY” , “UPDATES_ONLY” , “DELETES_ONLY” , “ADDS_AND_UPDATES” , “ADDS_AND_DELETES” , “UPDATES_AND_DELETES”},{“ADDS_ONLY” , “UPDATES_ONLY” , “ADDS_AND_UPDATES”})

USERS TABLE


Column Name Column Type Base Type Key? Initial Value App Formula Valid_If Suggested Values Input Mode Source Table isPartOf?
USER_ID Text - =UNIQUEID() - - - - - -
FIRST NAME Text - - - - - - - - -
LAST NAME Text - - - - - - - - -
USEREMAIL Email - - - - - - - - -
USERROLE Ref - - - - - - Buttons ROLES -
PRIVILEGES Text - - - =[USERROLE].[ACCESS_TYPES] - - - - -

TABLE UPDATE MODE


LOOKUP(USEREMAIL(),"USERS","USEREMAIL","PRIVILEGES")

Thank you very much…

@Tiger
You’re welcome. My sample is just to highlight the path. You can and need to expand the idea for your own needs and app requirements. Provided you struggle, you can post your questions anytime and we will be glad to help you to fix’em.

Top Labels in this Space