function roleassign_help in RoleAssign 8
Same name and namespace in other branches
- 5 roleassign.module \roleassign_help()
- 6 roleassign.module \roleassign_help()
- 7.2 roleassign.module \roleassign_help()
- 7 roleassign.module \roleassign_help()
Implements hook_help().
File
- ./
roleassign.module, line 16 - Allows site administrators to delegate the task of managing user's roles.
Code
function roleassign_help($route_name, RouteMatchInterface $route_match) {
$permissions = \Drupal::service('user.permissions')
->getPermissions();
switch ($route_name) {
case 'help.page.roleassign':
return t('
<p>RoleAssign specifically allows site administrators to further delegate the task of managing user\'s roles.</p>
<p>RoleAssign introduces a new permission called Assign roles. Users with this permission are able to assign selected roles to still other users. Only users with the Administer permissions permission may select which roles are available for assignment through this module.</p>
<h2>Background</h2>
<p>It is possible for site administrators to delegate the user administration through the Administer users permission. But that doesn\'t include the right to assign roles to users. That is necessary if the delegatee should be able to administrate user accounts without intervention from a site administrator.</p>
<p>To delegate the assignment of roles, site administrators have had until now no other choice than also grant the Administer permissions permission. But that is not advisable, since it gives right to access all roles, and worse, to grant any rights to any role. That can be abused by the delegatee, who can assign himself all rights and thereby take control over the site.</p>
<p>This module solves this dilemma by introducing the Assign roles permission. While editing a user\'s account information, a user with this permission will be able to select roles for the user from a set of available roles. Roles available are configured by users with the Administer permissions permission.</p>
<h2>Configuration</h2>
<ol>
<li>Log in as site administrator.</li>
<li>Go to the administration page for access control and grant Assign roles permission to those roles that should be able to assign roles to other users. Notice that besides the Assign roles permission, these roles also must have the Administer users permission.</li>
<li>Go to the administration page for role assign and select those roles that should be available for assignment by users with Assign roles permission.</li>
<li>For each user that should be able to assign roles, go to the user\'s account and select a role with both the Assign roles and the Administer users permissions.</li>
</ol>
<p><strong>Beware:</strong> granting Administer users permission to users will allow them to modify admin passwords or email addresses or even delete the site administrator account. The <a href=":user_protect">User protect</a> module can prevent this.</p>
<h2>Usage</h2>
<ol>
<li>Log in as a user with both the Assign roles and the Administer users permissions.</li>
<li>To change the roles of a user, go to the user\'s account and review the assignable roles and change them as necessary.</li>
</ol>', [
':user_protect' => 'http://drupal.org/project/userprotect',
]);
case 'roleassign.settings':
return t('Users with both %administer_users and %assign_roles permissions are allowed to assign the roles selected below. For more information, see the <a href=":help">help page</a>.', [
'%administer_users' => $permissions['administer users']['title'],
'%assign_roles' => $permissions['assign roles']['title'],
':help' => Url::fromRoute('help.page', [
'name' => 'roleassign',
])
->toString(),
]);
}
}