Created
May 22, 2011 11:28
-
-
Save boombatower/985380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 2c11d6558fb23488cb7b8652267eb561bee85fdd | |
| Author: Jimmy Berry <[email protected]> | |
| Date: Sun May 22 06:23:07 2011 -0500 | |
| Patch #1153072: Admin role doesn't provide all permissions. | |
| diff --git modules/user/user.module modules/user/user.module | |
| index 90d313b..000f70e 100644 | |
| --- modules/user/user.module | |
| +++ modules/user/user.module | |
| @@ -3751,21 +3751,19 @@ function user_register_submit($form, &$form_state) { | |
| } | |
| /** | |
| - * Implements hook_modules_installed(). | |
| + * Implements hook_flush_caches(). | |
| */ | |
| -function user_modules_installed($modules) { | |
| +function user_flush_caches() { | |
| // Assign all available permissions to the administrator role. | |
| - $rid = variable_get('user_admin_role', 0); | |
| - if ($rid) { | |
| - $permissions = array(); | |
| - foreach ($modules as $module) { | |
| - if ($module_permissions = module_invoke($module, 'permission')) { | |
| - $permissions = array_merge($permissions, array_keys($module_permissions)); | |
| + if ($rid = variable_get('user_admin_role')) { | |
| + $permissions = drupal_map_assoc(array_keys(module_invoke_all('permission'))); | |
| + $current = user_role_permissions(array($rid => $rid)); | |
| + foreach ($current[$rid] as $permission => $status) { | |
| + if (!isset($permissions[$permission])) { | |
| + $permissions[$permission] = FALSE; | |
| } | |
| } | |
| - if (!empty($permissions)) { | |
| - user_role_grant_permissions($rid, $permissions); | |
| - } | |
| + user_role_change_permissions($rid, $permissions); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment