function adminrole_update_permissions in Admin role 6
Same name and namespace in other branches
- 5 adminrole.module \adminrole_update_permissions()
- 7 adminrole.module \adminrole_update_permissions()
Update the admin role with all current available permissions.
4 calls to adminrole_update_permissions()
- adminrole_content_fieldapi in ./
adminrole.module - Implements hook_content_fieldapi().
- adminrole_enable in ./
adminrole.install - Implements hook_enable().
- adminrole_node_type in ./
adminrole.module - Implements hook_node_type().
- drush_adminrole_update in ./
adminrole.drush.inc - Drush callback; update the admin role with all current available permissions.
1 string reference to 'adminrole_update_permissions'
- adminrole_form_alter in ./
adminrole.module - Implements hook_form_alter().
File
- ./
adminrole.module, line 77 - This module simply gives a designated role all permissions every time the modules page is submitted.
Code
function adminrole_update_permissions() {
if ($rid = variable_get('user_admin_role', 0)) {
$permissions = module_invoke_all('perm');
if ($excluded = variable_get('adminrole_exclude_permissions', array())) {
$permissions = array_diff($permissions, $excluded);
}
db_query('DELETE FROM {permission} WHERE rid = %d', $rid);
if ($permissions) {
db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $rid, implode(', ', $permissions));
}
}
}