Last active
August 29, 2015 14:27
-
-
Save martsie/3dc7a2f54c5fbe9f567b to your computer and use it in GitHub Desktop.
Give all permissions back to the admin role
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
<?php | |
/** | |
* Give admin role permissions to all modules on site. | |
*/ | |
function my_custom_module_update_7001() { | |
$permissions = array(); | |
foreach (module_implements('permission') as $module) { | |
$module_permissions = module_invoke($module, 'permission'); | |
foreach (array_keys($module_permissions) as $permission) { | |
$permissions[$permission] = TRUE; | |
} | |
} | |
$admin_role = variable_get('user_admin_role'); | |
user_role_change_permissions($admin_role, $permissions); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be my_custom_module.install but gist highlighting breaks.