function roleassign_admin in RoleAssign 5
Same name and namespace in other branches
- 6 roleassign.module \roleassign_admin()
Returns a system settings form for the administrator to select which roles will be avaiable 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 93
Code
function roleassign_admin() {
// To admister roleassign, 'administer access control' permission
// is required.
if (!user_access('administer access control')) {
return;
}
// Get all avaiable 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 avaiable. You have to ' . l(t('create roles'), 'admin/user/roles') . ' that can be assigned.</p>',
);
}
// Return system settings form.
return system_settings_form($form);
}