graphql-engine
graphql-engine copied to clipboard
[RFC] customize name of "admin" role
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...
Proposed solution:
- Add an env var
HASURA_GRAPHQL_ADMIN_ROLE
and flag--admin-role
which defaults toadmin
- Read this value and add it to the server's context
- Use this value in
adminOnly
function defined inHasura.RQL.Types
and inonlyAdmin
function defined inHasura.Server.App
Ideally, there should be only one function to check admin. Can refactor if required.
Perfect.
Taking a shot to add this feature
@m13m any news on this? 🙂
Removing the wip
label until a PR is linked here.
Any update on this? It would be really beneficial.
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!
Is there an update to this?
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
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.
any update on this?