Skip to content

Instantly share code, notes, and snippets.

@martsie
Last active August 29, 2015 14:27
Show Gist options
  • Save martsie/3dc7a2f54c5fbe9f567b to your computer and use it in GitHub Desktop.
Save martsie/3dc7a2f54c5fbe9f567b to your computer and use it in GitHub Desktop.
Give all permissions back to the admin role
<?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);
}
@martsie
Copy link
Author

martsie commented Aug 11, 2015

Should be my_custom_module.install but gist highlighting breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment