graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

[RFC] customize name of "admin" role

Open nolandg opened this issue 5 years ago • 11 comments

Related losely to https://github.com/hasura/graphql-engine/issues/310

It would be a nice-to-have to be able to change the default "admin" role name. I don't think "admin" really describes the role very well in real world use cases. I build an application for a client and give it to them. They are the administrators of the site, they can add users, delete posts etc. I like to call them "admin".

What Hasura is calling "admin" now is more of a "super-user" or "root" who can and must be able to do everything. That's not what I want my site admins to do.

Now I'm struck trying to think of another good name for my admin role...

nolandg avatar Jun 06 '19 17:06 nolandg

Proposed solution:

  • Add an env var HASURA_GRAPHQL_ADMIN_ROLE and flag --admin-role which defaults to admin
  • Read this value and add it to the server's context
  • Use this value in adminOnly function defined in Hasura.RQL.Types and in onlyAdmin function defined in Hasura.Server.App

Ideally, there should be only one function to check admin. Can refactor if required.

shahidhk avatar Jun 17 '19 09:06 shahidhk

Perfect.

nolandg avatar Jun 17 '19 18:06 nolandg

Taking a shot to add this feature

m13m avatar Jun 18 '19 08:06 m13m

@m13m any news on this? 🙂

marionschleifer avatar Aug 07 '19 06:08 marionschleifer

Removing the wip label until a PR is linked here.

marionschleifer avatar Nov 19 '19 20:11 marionschleifer

Any update on this? It would be really beneficial.

rayhantr avatar Jul 24 '22 12:07 rayhantr

After 3 years this feature is, along with #3353 (only role deletion was added, no role renaming) still not yet realised. Having the ability to rename any role, not just "admin", would be great. Thanks!

WGTW avatar Aug 31 '22 15:08 WGTW

Is there an update to this?

jmarbutt avatar Nov 10 '22 18:11 jmarbutt

This feature would be great, looking to add a "super-admin" as well as "admin" role, but with the current setup it seems the best I can do is "admin" and "sub-admin" instead

MatthewDHarrison avatar Mar 27 '23 00:03 MatthewDHarrison

Even being able to rename it to "ADMIN" would be handy, as we are assigning roles from a user_role enum table, so UserRoleEnum.Admin is "ADMIN", not "admin", so we need to map the role to lower case. If we could rename the role, we would not need that step.

murfett-au avatar Jun 21 '23 03:06 murfett-au

any update on this?

theGowda avatar Jan 04 '24 07:01 theGowda