Restrict access to a button

Is it possible to restrict access to certain compenents in an app to a select number of users. So if I have 10 people that are able to access an app, i only want 4 to be able to have the ability to access a text field?

1 Like

Got the same question here. Will be awesome if that's possible

You could use some JavaScript in the hidden field of the components you want to hide.

I'm not the best with js but something like:

{{current_user.fullName = "John Smith" ? 'true' : 'false'}}

Something like that would hide the component if the username is John Smith. You can also use groups instead of usernames, so hide if user belongs to X group.

2 Likes

You can definitely do it with Security groups. Just create groups for users that you want to have access and then use the {{ current_user.groups }} in a Javascript query. Once you have those results, you can create a JSON SQL Query to select the users by group name and then use those results for hiding or disabling the components/scripts. I use this functionality all the time for Administrative menus or capabilities.

If you want the other users to see the text as read only, you can also use this logic in the "read only" field.