Userrole() default values

scott192
Participant V

When deploying an app to a domain what is the default Userrole() value set for anyone from the domain using the app?
I’d like to make an assumption that anyone who isn’t explicitly defined in the list of users allowed to use the app would get a value of “User” rather than “Admin” so that I can then add explicit users as Userrole(“Admin”).
Does anyone know whether Userrole() can be used this way? Or is it just for explicitly defined users in the Manage Users section of the editor?
The reason I asked is that a deployed app seems to think all domain users are Userrole(“Admin”). This is actually my first app that uses Userrole in ShowIf expressions to hide a behaviour on a row of a table.
Could it just be that as I am the author of the app that it just gives me Admin role anyway?

1 3 276
3 REPLIES 3

MultiTech
Participant V

An alternative to using that system would be to implement your own - pretty simple actually.


When you add users to your app, they’re assigned the “User” role by default;

  • but with the domains integration… perhaps there’s something getting in the way or mixed up.

I might reach out to support@appsheet.com

Thanks for the tip and the link for implementing this. I do have a directory of users that I can pinch to get this working. Does it work with security filters though?

MultiTech
Participant V

Indeed.

You can implement it two ways:

  1. pull values from your Current_User (slice)

Index(Current_User[User_Role], 1) = "Admin"
or for multiple
IN(Index(Current_User[User_Role], 1), list("Admin", "Dev", "Others"))

  1. do a hard lookup from the user table.
    LOOKUP(USEREMAIL(), Users, User_Login_Email, User_Role) = "Admin"

I prefer the first.

Top Labels in this Space