Edit and delete permission users roles

I want to give different permissions to all my users, can you tell me how to give permissions to users. 

0 4 779
4 REPLIES 4

First, you must have an app where users are required to authenticate.  I.e. Public apps are not a candidate for user permissioning.

There are a couple of options:

1)  AppSheet does provide a USERROLE() function that returns the value set for users you have added to the app within the Editor.  The role can be set to "Admin" or "User".  If that is all you need to determine if someone can Edit or Delete the row (e.g. Admin can Edit or Delete and User can only Edit) then you simply need to add an expression similar to below to the system Add and Delete actions:

In the Edit action Behavior maybe:
IN(USERROLE(), {"Admin", "User"})

 

2)  If you need more refined control over permissions, then you will need have a User table and custom build your permissions.  There many ways to do this.  For example, you could provide the list of permissions for each user such as Add, Edit, Delete, Read Only.  Another common approach is to assign each user to a custom role - maybe Admin, Manager, Supervisor, Teller, Apprentice, etc.  Then you can give access to certain areas of the app based on these roles. 

For example, maybe there are a set of views that only Managers are to see.  Then in the Show If of those views you might insert an expression like:

Any(CurrentUser[Role]) = "Manager"

Note: the expression makes use of a Slice  on the Users table named "CurrentUser" that is filtered by USEREMAIL() = [Login Email].  Using a slice in this manner to get the current user will simply access to the user details and increase performance so that you do not need to have SELECT() expressions everywhere.

There really are a lot of different ways to achieve what you are asking.

I think it will be much better if you could provide examples of what you are trying to achieve.

if you can let us know a few examples, we will be able to help you in a more accurate way.

I want my users to stop showing delete option only after 3 hours of entry. But delete option show to admin. Is it possible? So tell me how?

 

Your table should have a "timeStamp" column registering the dateTime of the entry. Then from Behavior, go to Delete action in your table, and put this expression in Only if this condition is true field:

OR(
  USERROLE() = "Admin",
  NOW() - "003:00:00" < [timeStamp]
)

Top Labels in this Space