function roleassign_admin in RoleAssign 6
Same name and namespace in other branches
- 5 roleassign.module \roleassign_admin()
Returns a system settings form for the administrator to select which roles will be available to assign for users with the <code>assign roles</code> permission.
1 string reference to 'roleassign_admin'
- roleassign_menu in ./
roleassign.module - Implementation of hook_menu().
File
- ./
roleassign.module, line 77 - Allows site administrators to further delegate the task of managing user's roles.
Code
function roleassign_admin() {
// To admister roleassign, 'administer permissions' permission is required.
if (!user_access('administer permissions')) {
return;
}
// Get all available roles except for 'anonymous user'
// and 'authenticated user'.
$roles = user_roles(true);
unset($roles[DRUPAL_AUTHENTICATED_RID]);
// Show checkboxes with roles that can be delegated if any.
if ($roles) {
$form['roleassign_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#options' => $roles,
'#default_value' => variable_get('roleassign_roles', array()),
'#description' => t('Select roles that should be available for assignment.'),
);
}
else {
$form['roleassign_roles'] = array(
'#type' => 'markup',
'#value' => '<p>No assignable roles available. You have to ' . l(t('create roles'), 'admin/user/roles') . ' that can be assigned.</p>',
);
}
// Return system settings form.
return system_settings_form($form);
}