How to assign user roles?

Ok, so I see a bunch of videos on here linking to the same video tutorials, but none actually show the process of setting up the logic.

Like this one, for example

I’m trying to build a simple dashboard that one of my employees can go on, search for a user, and change their role/permissions.

From here I should be able to show them different features, dashboards, etc.

The funnel should work like this

User signs up > They have a basic dashboard with almost 0 functionality (for right now) > we go to our admin dashboard, assign them a role > they get access to certain features, information, etc based on that role.

Any help would be amazing.

Use an Option Set to define the Roles

Have a field on the User datatype of type ‘Role’, where you can set the Role for a specific User (in some cases, where a user can have more than 1 Role, you might want to make that field a list).

Then simply show/hide certain parts of your app based on the Current User’s Role…

2 Likes

Thank you, Adam!

Right now on the Admin dashboard I have a list of all usernames, but I can’t figure out how to let admins click on that user’s name, or maybe have a drop down menu next to the user name, something like that, and change that specific user’s role.

To add to Adam’s advice (and also because I literally just helped someone with the same thing), you also have to make sure your privacy rules on the User data type allow the admin to find other users in searches and change their roles.

2 Likes

This is great advice, Mike.

I still can’t figure out how to actually change the role though.

What’s the logic?

Like, I have the admin role given out, and they can see all of the user names on the platform, but what I’m looking to do is to have some type of drop down menu next to each of the names in the repeating list of users, and then be able to change “current cell’s user user_role” whenever I click a save button.

But I just can’t seem to find out how to do any of that :cry:

Well, you could do it pretty much how you just described, and you could skip the save button if you want.

Show the admin a repeating group of users. Add a dropdown to the repeating group that shows the role options, and have the default value of the dropdown be the current cell’s user’s role. Then, add a workflow using the An input’s value is changed event, select the dropdown as the input, and add an action to the event that sets the current cell’s user’s role to the dropdown’s value.

1 Like

Ok, awesome. So I have the dropdown, took away the button, but now the dropdown is not showing any roles, even though I’ve chosen dynamic and had it show all options.

Did you fill in the option caption field?

1 Like

Thank you, Mike!

You’re a rockstar.

1 Like