Adding new users as Admin from within Glide

Hello

I don’t seem to be able to get a form to write to the Role column on the Users table (which is also set as Role in settings)

I am hoping Admins can add users, and specify a role for them from within the app - but when choosing the Role column to write to (from a choice component, which is reading the list of roles available from a separate table) - the column is left blank. I tried writing to a different non-computed column and it worked as expected.

Am I doing something wrong?

Thanks,
Andrew

The last I remember, Roles can only be set if the user setting it possess the same Role themselves. Assuming the admin is trying to set a role for a non-admin, it’s not a role the Admin possess themselves so they cannot set it on someone else’s row.

Even then, I’m not sure if that’s true or not anymore. Most people use external services like Make along with the Glide API to set the role.

3 Likes

Jeff is correct on all counts. If you have a Business Plan or better, I’d recommend adding the new user row with a Call API action. If you don’t have a Business Plan, then you’d have to add it via Make.

3 Likes

Thanks both (as always)

I’ve actually got it working natively in Glide now.

An Admin has access to a user list page with three action buttons. Each action button opens a form, then triggers an action on submit. That action seems to be able to write to the Roles column just fine. Need to do a little more testing to be sure, but seems to be ok

What happens if you reload the builder afterwards?
I’d be very surprised if the change isn’t reversed.

1 Like

Ouch - you were quite right. That threw me. Thought I had it working nicely.

Don’t really want to use Make or anything. I am comfortable doing so, and have used it loads - just don’t want to have to add an integration.

Not sure I understand why this is the case. Seems odd.

Is there no other way of adding users from within the front end, that don’t have the same role as the logged in user?

EDIT - I think I was overcomplicating things somewhat. In effect, I only really need either an Admin or a User. So I can have a page only accessible to Admins - where they can add users. The users role will then be blank - but I can work around that (I think!)

It’s largely for security reasons. No user should be able to assign a particular role that they are not a part of. The fact that your role is called ‘Admin’ doesn’t mean it has higher privileges than any other role (unless you explicitly program for it). It’s ‘Admin’ by name only. I could call myself ‘Master of the Universe’ but the title doesn’t make it so.

Sounds like there is no reason for your general users to have a role at all. In fact leaving the role blank can keep them as public users instead of private users, so you won’t be up against the private user limits.

3 Likes

In the cases where an app is using roles to determine access / visibility to various parts of that app… It would be a problem if you could assign any role you like to any user. For example, you may have a “manager” role and a “god” role… the “god” role could have unlimited access to everything. You would not want a “manager” role to be able to assign the “god” role in this case.

3 Likes

Thank you both

As always - that makes perfect sense now I think about it. I was wrongly assuming that if you have Admin as a role; you can do anything but see now there is no hierarchy.

All makes sense and I can do what I need to do thanks to your help.

Much appreciated

Andrew

4 Likes

Hi all

Just to finally close this one out - am I right in saying it is not possible to add a new user and assign them a role different to their own, from the front end / published app? (Without using a third party application like Make etc)

The only way is to add the role is directly into the table. In my current use case, I have worked a way to do what I need without assigning a role - but wanted to check in case it comes up again.

Thanks
Andrew

Yes, I think that’s correct.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.