Add RoleAssign to core

Created on 13 December 2016, over 8 years ago
Updated 24 June 2025, 9 days ago

Idea summary

What is the problem to solve?

If I have created a Drupal site with different roles defined, I have no way of delegating the task of role assignment to another Drupal user, without given them the "Administer permissions" permission, which gives them a lot of potentially unwanted extra power.

Specific use case:

I have set up a Drupal 8 site with the following roles:

  • Administrator
  • Staff
  • Contributor

Role "Administrator" has been given all permissions, including "Administer permissions".
Role "Staff" has been given permission "Administer users", as I want to delegate managing the user accounts on the website to them, while I, as an Administrator, focus on the configuration of the website.

In the above use case a user with role "Staff" can block or unblock users, edit their user picture, etc... In short, they can moderate the user accounts. What they cannot do however, is assign the role "Contributor" to users (e.g. when those have gone through a review phase and are deemed worthy contributors to the site).

The only way I can currently allow the user with role "Staff" to assign the role "Contributor" to various other users on the site, is by giving the "Administer permissions" permission to the "Staff" role. When I do so, they can indeed start assign the "Contributor" role to selected site users.

This has the following (unwanted) implications however:

  • A user with the role "Staff" can now assign themselves the role "Administrator", and start fiddling with the site configuration
  • Even without granting themselves extra role(s), users with role "Staff" can now suddenly manage permissions.

What I would want as an admin, is to grant the role "Staff" a new permission, e.g. "Assign safe roles", and configure (globally) which roles I consider to be safe.

In the above use case I could select the role "Contributor" and "Staff" to be safe, and "Administrator" unsafe.
Granted the "Assign safe roles" permission, users with role "Staff" could then assign users on the site as contributors, or assign colleague staff users, but they could not change permissions or grant themselves the administrator role.

Who is this for?

- Site owners / site managers / (advanced) site builders, wanting to delegate role assignment to other users.

Result: what will be the outcome?

Add the module RoleAssign β†’ or at least its feature to core. From the module description;

RoleAssign specifically allows site administrators to further delegate the task of managing user's roles while withholding the Administer permissions permission. RoleAssign introduces a new permission called Assign roles. Users with this permission are able to assign selected roles to still other users. Only users with the Administer permissions permission may select which roles are available for assignment through this module.

How can we know the desired result is achieved?

When site administrators can safely decide to give some of their users permission to assign roles considered safe for assignment, while not giving them the opportunity to escalate their permissions or grant themselves roles considered unsafe - without the need to rely on a contrib module like RoleAssign.

Perhaps a usability test can be set up with experienced site administrators / configurators, giving them the task to configure their Drupal site like the use case mentioned above, tracking their feedback and frustrations.
In case their solution would consist of granting the "Administer permissions" permission to the "Staff" role, verifying if they are aware of the unwanted consequences of that action.

✨ Feature request
Status

Active

Component

General

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    The Ideas project is being deprecated. As discussed in a core committer meeting issues that are adding modules are being moved to the Drupal CMS project for discussion.

  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia
  • πŸ‡¦πŸ‡ΊAustralia pameeela

    This was on a list somewhere, but fell off. I think it probably belongs in the site template rather than vanilla Drupal CMS though because the permissions need to be specific to the roles provided. In theory, Drupal CMS could include it by default though and allow the templates to configure it.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Although I'm not the last word here, I'm against adding modules just so that they'll be there for site templates to use; it's trivial for a template to include a dependency on a module that it wants to use. If we can do some kind of initial configuration or value-add on top of Role Assign, that's one thing and I'm for it, but it doesn't sound like that's what's being proposed here?

  • πŸ‡§πŸ‡ͺBelgium svendecabooter Gent

    FYI:
    At this point in time I would suggest to include the https://www.drupal.org/project/role_delegation β†’ into Drupal CMS, rather than https://www.drupal.org/project/roleassign β†’ , given that the former is more actively maintained, and has a wider install base.

    This only if there is a need to include anything at all, as per phenaproxima's comment above.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    I'm against adding modules just so that they'll be there for site templates to use

    I am too, but considering making an exception here because this is a real "gotcha" in Drupal and it would be nice to provide a way around it OOTB.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    If that's the case, then maybe we add it to a one of the basic recipes -- I'm thinking either drupal_cms_admin_ui or drupal_cms_authentication, although neither one really fits the bill entirely. Maybe drupal_cms_starter would be the right place.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    The fact that Role Delegation is a better choice (which I agree with) makes me even more inclined to add it, so there is consistency in solving this problem.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Setting up such a module in a secure way isn't straight forward. Specifically, you need to be careful that you don't allow your staff users access to edit admin users. We use https://www.drupal.org/project/userprotect β†’ for that in combination with roleassign. Not sure if role_delegation needs that too or not.

    There are also core issues to make changes on those permissions to make the whole thing more secure by default. See πŸ› [regression] User roles field access is inconsistent, users with 'administer users' permission can gain full access Needs work and ✨ Split 'administer permissions' into a new administer roles permissions Needs work (low 6 digits!)

    I'm not up to speed on what roles Drupal CMS has by default, but IMHO, role assign/delegation isn't a feature on its own, merely a means to provide the staff-level role feature that can manage users with the same or lower level of access. That seems better suited to an optional recipe, bundled or not, than having it on/shipped by default?

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    IMHO, role assign/delegation isn't a feature on its own, merely a means to provide the staff-level role feature that can manage users with the same or lower level of access. That seems better suited to an optional recipe, bundled or not, than having it on/shipped by default?

    Yes, that's correct, site templates would provide the roles and configure this sensibly. But if we include the module it eliminates the module selection process by the site template creator and consolidates usage to that module.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    Doesn't seem like either of the core issues deals specifically with restricting the roles that can be assigned, although ✨ Split 'administer permissions' into a new administer roles permissions Needs work prevents non-admins from granting the admin role so IMO that would still be a big improvement and might mitigate the need for this.

Production build 0.71.5 2024