Admin Role module assigns perms to wrong or no role

vfranklyn - October 21, 2008 - 20:27
Project:Admin Role
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)
Description

Hi there,

Forgive me if this issue as already been addressed, I am a newbie and I tried to find any information about this in the forums and was unsuccessful. I'm running Drupal 6.5 and here is the problem I am having with adminrole 6.x-1.0-beta2:

1. I installed Admin Role
2. I enabled the module
3. I created a new Role called "Administrator"
4. I assigned Admin Role to "Administrator"
5. I checked Permissions and my "Blogger" role had received all the permissions from Admin Role, instead of "Administrator".
6. I tried this with "Blogger" role and it worked fine, and with "Forum Moderator" role and it worked fine as well.
7. I renamed the "Administrator" role to various other names, but still had the same problem.
8. I deleted the "Administrator" role, disabled AdminRole, created "Administrator", enabled AdminRole and tried again and still it assigned all permissions to "Blogger".
9. I uninstalled and reinstalled the module and still the same thing happened.
10. I deleted the "Blogger" role and tried again, and then when I assigned the AdminRole to "Administrator" no permissions were assigned to any role. The same thing happened when I deleted and recreated "Forum Moderator", now no permissions are assigned to any role.
11. I tried applying the patch http://drupal.org/node/309393, but to no avail. Of course, I am a newbie and while I read the patch documentation, I'm not sure I applied the patch correctly through cPanel. I did change the actual code in the module per the instructions in the above thread, but no luck there either.
12. The two roles that worked for Admin Role ("Blogger" and "Forum Moderator") are roles I had created before I upgraded to 6.5. I'm not sure if that makes any difference.

Any help would be appreciated.

Thanks!

#1

lee20 - October 28, 2008 - 10:26
Title:Admin Role module assigns permissions to wrong role or to no role at all» Admin Role module assigns permissions to wrong role or to no role at all (fixed in DRUPAL-6--2, needs added to current release)
Status:active» reviewed & tested by the community

I was experiencing this same issue because there was a role that had been deleted. The values for the select box on the settings page would being set in numerical order, so setting the role to anything after the break in sequence (1,2,3,5,6,7) and would make the options (1,2,3,4,5,6).

I was going to upload a patch but noticed that it was already fixed when checking out DRUPAL-6--2 drupal via CVS.

@vfranklyn - can you create a new release with that fix in it please?

This is the function that had the problem, replace it in your adminrole.module file and then go and back and set the admin role, but be sure the form gets refreshed.

<?php
function adminrole_admin_settings() {
 
$form = array();
 
 
$u_roles = user_roles();
 
// Removing Authenticated and anonymous roles
 
unset($u_roles[1]);
  unset(
$u_roles[2]);
 
 
$u_roles[0] = t('-- Please Select One --'); 
 
ksort($u_roles);
 
 
$form['adminrole_adminrole'] = array(
  
'#type' => 'select',
  
'#title' => t('Admin Roles'),
  
'#default_value' => variable_get('adminrole_adminrole', 0),
  
'#description' => t("Which role should get all permissions?"),
  
'#options' => $u_roles,
  );
  return
system_settings_form($form);
}
?>

#2

DanielTheViking - November 10, 2008 - 11:59

Subscribing.

#3

vfranklyn - November 10, 2008 - 23:36

Hi lee20,

I tried your fixed and it worked!! Thanks so very much for the help!

@vfranklyn - can you create a new release with that fix in it please?

From what I've read, I can't create a new release of a module unless I have CVS access to the project. Besides, I'm guessing the owner of this module might want to create the release instead of me. As a newbie, my chances of screwing it up seem high...

Thanks again!

#4

lee20 - November 11, 2008 - 22:21

@vfranklyn - Oops I meant to direct that towards the module owner.

@JacobSingh - Can you create a new release with this fix in it? If not, grant me CVS commit access and I can. -Thanks

#5

udavid - November 16, 2008 - 19:43

Hi there,

i´ve fixed it without unsetting the two roles.

function adminrole_admin_settings() {
   $form = array();
   $u_roles = user_roles();       
   reset($u_roles);
   $u_roles[0] = t('-- Please Select One --');
   natsort($u_roles);
  
   $form['adminrole_adminrole'] = array(
     '#type' => 'select',
     '#title' => t('Admin Roles'),
     '#default_value' => variable_get('adminrole_adminrole', 0),
     '#description' => t("Which Role is Admin?"),
    '#options' => $u_roles,
   );
   return system_settings_form($form);
}

Thanks for this tiny helper module. :-)

#6

Bevan - January 7, 2009 - 20:23
Status:reviewed & tested by the community» needs work

Please test whether this issue can be reproduced with latest d6 dev (DRUPAL-6--1). If so, please roll a standard patch fo it and update the issue's version and status. Thanks! ;)

#7

Bevan - January 7, 2009 - 20:33
Title:Admin Role module assigns permissions to wrong role or to no role at all (fixed in DRUPAL-6--2, needs added to current release)» Admin Role module assigns perms to wrong or no role

#8

lee20 - January 12, 2009 - 17:11
Status:needs work» closed

They just released RC2 which includes this fix.

#9

Bevan - January 12, 2009 - 21:08
Status:closed» fixed

Please mark fixed issues as fixed and let drupal.org mark as closed. Thanks!

#10

System Message - January 26, 2009 - 21:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#11

DanielTheViking - January 30, 2009 - 17:41

Is this issue only relevant for v6.x, or also for v5.x?
(current 5.x stable version is from last summer)

#12

Bevan - January 30, 2009 - 20:20

This was only ever a bug in the 6 version (AFAIK) and was fixed there.

#13

tttt - February 10, 2009 - 19:59

This is an issue for 5.x 1.5 as well. Fix works.

#14

DanielTheViking - February 13, 2009 - 18:44
Version:6.x-1.0-beta2» 5.x-1.x-dev
Status:closed» patch (to be ported)
 
 

Drupal is a registered trademark of Dries Buytaert.