function administerusersbyrole_help in Administer Users by Role 8.3
Same name and namespace in other branches
- 8.2 administerusersbyrole.module \administerusersbyrole_help()
Implements hook_help().
File
- ./
administerusersbyrole.module, line 259 - Administer Users by Role main module file.
Code
function administerusersbyrole_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.administerusersbyrole':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Administer Users by Role allows site builders to set up fine‐grained permissions for allowing <i>sub‐admin</i> users to manage other users based on the target user\'s role.');
$output .= ' ' . t('The module defines new permissions to control access to edit/delete users and assign roles - more specific than Drupal Core\'s all‐or‐nothing “Administer users” and “Administer permissions”.');
$output .= ' ' . t('It also provides a “Create new users” permission and fine‐grained permissions for viewing users.') . '</p>';
$output .= '<h3>' . t('Configuration') . '</h3>';
$output .= '<p>' . t('Use the <a href=":config">configuration settings</a> to classify each role.', [
':config' => Url::fromRoute('administerusersbyrole.settings')
->toString(),
]) . '</p>';
$output .= administerusersbyrole_help_role_options();
$output .= '<h3>' . t('Core permissions') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Administer users') . '/' . t('Administer permissions') . '</dt>';
$output .= '<dd>' . t('<em>Do not</em> set these for sub‐admins. These permissions bypass all of the permissions in “Administer Users by Role".') . '</dd>';
$output .= '<dt>' . t('View user profiles') . '</dt>';
$output .= '<dd>' . t('Don\'t set this if you wish to use the fine-grained permissions for viewing users.') . '</dd>';
$output .= '<dt>' . t('Select method for cancelling account') . '</dt>';
$output .= '<dd>' . t('If you set this for sub‐admins, then the sub‐admin can choose a cancellation method when cancelling an account. If not, then the sub‐admin will always use the default cancellation method.') . '</dd>';
$output .= '</dl>';
$output .= '<h3>' . t('New permissions') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Access the users overview page') . '</dt>';
$output .= '<dd>' . t('Grants access to <a href=":people">manage users page</a>. Only users that can be edited are shown.', [
':people' => Url::fromRoute('entity.user.collection')
->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Create new users') . '</dt>';
$output .= '<dd>' . t('Grants access to <a href=":create">create users</a>.', [
':create' => Url::fromRoute('user.admin_create')
->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Allow empty user mail when managing users') . '</dt>';
$output .= '<dd>' . t('Create and manage users that have no email address.') . '</dd>';
$output .= '<dt>' . t('Assign allowed roles') . '</dt>';
$output .= '<dd>' . t('Allows assigning of any roles that have been configured as <i>allowed</i>.') . '</dd>';
$output .= '<dt>' . t('Edit users with allowed roles') . '</dt>';
$output .= '<dd>' . t('Allows editing of any user with <i>allowed</i> roles.') . '</dd>';
$output .= '<dt>' . t('Cancel users with allowed roles') . '</dt>';
$output .= '<dd>' . t('Allows cancelling of any user with <i>allowed</i> roles.') . '</dd>';
$output .= '<dt>' . t('View users with allowed roles') . '</dt>';
$output .= '<dd>' . t('Allows viewing of any user with <i>allowed</i> roles. Note that this permission only controls direct viewing of a single user, it does not affect Views.') . '</dd>';
$output .= '</dl>';
$output .= '<p>' . t('There will be 4 extra permissions (assign/edit/cancel/view) for each role configured as <i>custom</i>.') . '</p>';
$output .= '<h3>' . t('Assign role without permission to edit users') . '</h3>';
$output .= '<p>' . t('A sub-admin without access to edit users can assign roles using actions in the <a href=":people">manage users page</a>.', [
':people' => Url::fromRoute('entity.user.collection')
->toString(),
]);
$output .= t('The sub-admin can assign roles to a user if EITHER the sub-admin can edit the user OR the sub-admin can assign all the roles the user already has.') . '</p>';
$output .= '<h3>' . t('Example') . '</h3>';
$output .= '<p>' . t('You have an organisation website with the following roles:') . '</p>';
$output .= '<ol>';
$output .= '<li>' . t('Overall Administrator - all permissions') . '</li>';
$output .= '<li>' . t('Content Editors - are not members and are managed by the administrator') . '</li>';
$output .= '<li>' . t('Membership secretary - needs to view and edit membership information') . '</li>';
$output .= '<li>' . t('Ordinary Members - have basic authenticated user rights') . '</li>';
$output .= '</ol>';
$output .= '<p>' . t('What is wanted is for the membership secretary to be able to view and edit members, but not other roles, therefore the roles are configured as follows:') . '</p>';
$output .= '<ol>';
$output .= '<li>' . t('Administrator (Forbidden by default)') . '</li>';
$output .= '<li>' . t('Content editors - Forbidden') . '</li>';
$output .= '<li>' . t('Membership Secretary - Allowed') . '</li>';
$output .= '<li>' . t('Ordinary Members - Allowed') . '</li>';
$output .= '</ol>';
return $output;
case 'administerusersbyrole.settings':
$perms_link = Url::fromRoute('user.admin_permissions', [], [
'fragment' => 'module-administerusersbyrole',
])
->toString();
$output = '<p>' . t('Use this page to classify each role before you <a href=:perms>assign permissions</a>.', [
':perms' => $perms_link,
]) . '</p>';
$output .= administerusersbyrole_help_role_options();
$output .= t('See the <a href=":help">module help</a> for information.', [
':help' => Url::fromRoute('help.page', [
'name' => 'administerusersbyrole',
])
->toString(),
]);
return $output;
}
}