When a user that has administration privileges edits another user account, the 'You do not have permission to unblock .' always pops up.

I traced it to how it is passing the permission to the user_access() function. The $account that gets passed in has a roles array, but it looks like this:

array (
8 => '8',
10 => '10',
12 => '12');

Where the code is expecting the $account->roles array to look like this:

array (
8 => 'editor',
10 => 'teacher',
12 => 'staff );

As a result, when you save the user account, the update is successfully saved, but you see the dsm:

'You do not have permission to unblock .'

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rich.yumul’s picture

Status: Active » Needs review
FileSize
924 bytes

Attached is my patch that grabs the user roles and fixes the array that is checked.

Status: Needs review » Needs work

The last submitted patch, check_role_name-2106945.patch, failed testing.

rogical’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs work » Needs review
FileSize
732 bytes

re-rolled the patch.

BWPanda’s picture

Status: Needs review » Reviewed & tested by the community

Works fine for me.

AdamPS’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +beta2

I intend to fix this as part of #2378869: Meta-issue for Beta 2 release. Please sign up as a follower of that issue and see the patch there that I would like feedback on.

I no longer see this bug. I've not taken the patch from here as I'd changed the logic around anyway to fix other issues. Please confirm my new patch works for you.

AdamPS’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Status: Needs review » Closed (fixed)

Fix now available in latest release