Hi guys this module looks like exactly what my usecase needs. This this is my first-time install of the module.

I have a role of privileged users (MgtCommittee) and I want these folks to be able to set the roles of new users in less-privileged roles, say "registered maintainer" in my example.

I've gone through the docos and have:

  1. Given the MgtCommittee perms to manage users and assign roles
  2. Set the lower-class role to be available to AssignRoles

However, when my MgtCommittee user edits an existing user (eg, Joe Testing) or creates a new user, they get a recount of (Assignable Roles), but they do not get a checkbox button form element so they can assign the applicable role (eg, registered maintainer)

screenshot

I am also using the NodeAccess module, but only for user-level grants on nodes (ie, no role-based permissions).

Is there anything I can do to troubleshoot or figure out what is going on here?

Thanks!

Comments

boabjohn created an issue. See original summary.

nick dewitte’s picture

Component: User interface » Code
Category: Support request » Bug report
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new1.6 KB

This issue is caused when saving the array of roles that can be modified.
It is saved in a format that is different from the array returned by user_role_names(TRUE);.
When loading the roles that are present on both of these arrays, none are returned, because they don't have the same format.

I've created a patch that uses the "correct" format (machine_name => Display name) to save the list of roles that can be modified when submitting the form.

nick dewitte’s picture

Status: Needs review » Needs work

It appears I've missed something.

When loading the form, the current configuration is not shown.

nick dewitte’s picture

Status: Needs work » Needs review
StatusFileSize
new2.39 KB

Changes:
- Fixed default values for the form display.
- Fixed faulty data when enabling only some roles.
- Fixed missing punctuation.

boabjohn’s picture

Hey there @nick.dewitte yer a legend mate! I'm just testing within my own little world, but it looks like this patch is a beauty. We're in business.
Cheers!

cola’s picture

can confirm patch works

Edit: Sorry have to write again, the path is not working on Drupal 9. The roles are not saved

liam morland’s picture

I found that after applying this patch, I needed to visit admin/people/roleassign and re-save the configuration. That made the roles appear, but I still could not save them. It would say "There was a problem with your form submission."

cedewey’s picture

Status: Needs review » Needs work

Marking this as Needs Work since several people reported issues with the latest patch.

sophiavs’s picture

Assigned: Unassigned » sophiavs

Hi, i'll try to work on this

sophiavs’s picture

StatusFileSize
new873 bytes
new21.36 KB

Since the previous patch was working for some people and not for others i created a new patch from the begging.
It appears to be working. In case of any suggestion just comment that i can improve :)

sophiavs’s picture

Assigned: sophiavs » Unassigned
Status: Needs work » Needs review
lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned
Issue summary: View changes
StatusFileSize
new51.92 KB
new57.38 KB

Hi!

Patch in #10 works well, +1 for this.

Here's what I did in this review:
- created "MgtCommittee" and "registered maintainer" roles;
- added users "mgtcommittee" and "joe_testing" with the roles above;
- went to /admin/people/roleassign and I selected roles "MgtCommittee" and "registered maintainer";
- added the following permissions:

Assign roles
Warning: Give to trusted roles only; this permission has security implications. Allow users with the "Administer users" permission to assign a restricted set of roles.

Administer users
Warning: Give to trusted roles only; this permission has security implications. Manage all user accounts. This includes editing all user information, changes of email addresses and passwords, issuing emails to users and blocking and deleting user accounts.

- then I logged as mgtcommittee and went to /user/3/edit.

Before:

previous behavior (without patch) explained in the IS

After:

new behavior after applying the patch

Leaving status as "Needs Review" for those who had problems before check it again.

lucassc’s picture

Status: Needs review » Reviewed & tested by the community

I think it can be marked as RTBC If no one else disagrees.

rajab natshah’s picture

Priority: Major » Critical

I faced this issue, while testing #3297982: Automated Drupal 10 compatibility fixes

rajab natshah’s picture

It feels that this module is not functional.

following with

Configuration

  • Log in as site administrator.
  • Go to the administration page for access control and grant Assign roles permission to those roles that should be able to assign roles to other users. Notice that besides the Assign roles permission, these roles also must have the Administer users permission.
  • Go to the administration page for role assign and select those roles that should be available for assignment by users with Assign roles permission.
  • For each user that should be able to assign roles, go to the user's account and select a role with both the Assign roles and the Administer users permissions.

Assertions in the Automated testing are not doing the right needed checks.

rajab natshah’s picture

Thank you for the patch from #10

nord102’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Although there has been some documented steps in this thread, I am having trouble reproducing this. Can someone provide some clearer steps on how to reproduce as well as what version of core you're testing on?