function userprotect_help in User protect 5
Same name and namespace in other branches
- 6 userprotect.module \userprotect_help()
- 7 userprotect.module \userprotect_help()
Implementation of hook_help().
Returns various help texts.
File
- ./
userprotect.module, line 9
Code
function userprotect_help($section) {
switch ($section) {
case 'admin/user/userprotect':
case 'admin/user/userprotect/protected_users':
$output = t('These settings override any !protected_roles for the user in question. For more information on how to configure userprotect settings, see the !help.', array(
'!help' => l(t('help section'), 'admin/help/userprotect'),
'!protected_roles' => l(t('role-based protections'), 'admin/user/userprotect/protected_roles'),
));
return $output;
case 'admin/user/userprotect/protected_roles':
$output = t('These settings add protections to any user who is in the specified role. They are overridden by any !protected_users for the user in question. For more information on how to configure userprotect settings, see the !help.', array(
'!help' => l(t('help section'), 'admin/help/userprotect'),
'!protected_users' => l(t('per-user protections'), 'admin/user/userprotect/protected_users'),
));
return $output;
case 'admin/user/userprotect/administrator_bypass':
$output = t('These settings add bypasses to any user who has the \'administer users\' permission. They override the !protection_defaults for the user in question. For more information on how to configure userprotect settings, see the !help.', array(
'!help' => l(t('help section'), 'admin/help/userprotect'),
'!protection_defaults' => l(t('defaults'), 'admin/user/userprotect/protection_defaults'),
));
return $output;
case 'admin/user/userprotect/protection_defaults':
$output = t('Set global default protection values here. For more information on how to configure userprotect settings, see the !help.', array(
'!help' => l(t('help section'), 'admin/help/userprotect'),
));
return $output;
case 'admin/help#userprotect':
$admin = t('Administer');
$user_mgmt = t('User management');
$userprotect = t('User Protect');
$protected_users = t('Protected users');
$protected_roles = t('Protected roles');
$administrator_bypass = t('Administrator bypass');
$protection_defaults = t('Protection defaults');
$access_control = t('Permissions');
$pointer = ' -> ';
$output = t('<p>This module provides various editing protection for users.
The protections can be specific to a user, or applied to all users in a role.
The following protections are supported:</p>
<ul>
<li>username</li>
<li>e-mail address</li>
<li>password</li>
<li>status changes</li>
<li>roles</li>
<li>deletion</li>
<li>all edits (any accessed via user/X/edit)</li>
</ul>
<p>When a protection is enabled for a specified user (or the protection is
enabled because the user belongs to a role that has the protection), it
prevents the editing operation in question that anyone might try to perform
on the user--unless an administrator who is permitted to bypass the protection
is editing the specified user. The module will protect fields by disabling
them at user/X/edit.<p>
<p>User administrators my be configured to bypass specified protections, on either
a global or per-administrator basis.</p>
<p>These protections are valid both when trying to edit the user directly from their
user/X/edit page, or using the !admin_user.</p>
<p>The module also provides protection at the paths user/X/edit and user/X/delete,
should anyone try to visit those paths directly.</p>
<p><em>Note: this module is compatible with the !roleassign module.</em></p>
<h4>SETTINGS:</h4>
<p>At !userprotect_settings,
you\'ll find the settings for the module. When the module is initially enabled,
the default settings are such:</p>
<ul>
<li>User administrators bypass all protections.</li>
<li>The root user specifically bypasses all protections.</li>
<li>The anonymous user is specifically protected from all edits.</li>
<li>The root user is specifically protected from all edits.</li>
<li>All role protections are disabled.</li>
<li>The \'change own e-mail\' and \'change own password\' permissions
are enabled for authenticated users in the userprotect section at
!access_control.
</ul>
<p>This effectively amounts to no protections. It is suggested that you turn off
as many default administrator bypass settings as possible, and set bypass settings
for specific user administrators--this allows you to take advantage of the status,
roles, deletion, and edit protections in a meaningful way. Because of the per-user
bypass/protection settings for the anonymous and root user, this will also
begin protecting those users, without compromising the root user\'s access to the
entire site.
</p>
<p><strong>Important note:</strong> In order to protect a user from a deletion by
visiting user/X/delete directly, you <em>must</em> enable the \'delete\' protection
specifically. The \'all account edits\' protection only disables the delete button
at user/X/edit!</p>
<p>Also note that this module only provides protection against actions via the website
interface--operations that a module takes directly are not protected! This module
should play well with other contributed modules, but there is no guarantee that all
protections will remain intact if you install modules outside of the drupal core
installation.</p>
<h4>ADDING PROTECTIONS FOR A SINGLE USER:</h4>
<p>This is done at !protected_users.
Any time a user is added for protection, they will initially receive the default
protections enabled at !protection_defaults.</p>
<h4>ADDING PROTECTIONS FOR ROLES:</h4>
<p>This is done at !protected_roles.
<em>Be cautious</em> about adding protections by role, or you can lock out users
from things unintentionally!</p>
<p>In particular, note the if you enable role protections for a specific role, and
you have no bypasses enabled, you\'ve effectively locked out any role editing for
that role by anybody, unless you come back to the settings page and disable the role
protection!</p>
<h4>ADDING ADMINISTRATOR BYPASS RULES:</h4>
<p>One of the more powerful features of the module is administrator bypass
Any user that has been granted the \'administer users\' permission can
be configured to bypass any protection, either via the default administrator
bypass settings at !protection_defaults,
or via a per-administrator setting at !administrator_bypass.
If a bypass is enabled for a user administrator, they will be given editing rights
on that protection regardless if it is enabled for a single user or an entire role.</p>
<p>Note that the per-administrator bypass settings override the default bypass
settings.</p>
<h4>DEFAULT PROTECTION SETTINGS:</h4>
<p>Set the default protections for newly protected users at !protection_defaults.
In addition, you can enable the auto-protect feature, which will automatically
add the default protections to any newly created user accounts, and set default
bypass options for all user administrators.</p>
<h4>HOW THE MODULE DETERMINES A PROTECTION:</h4>
<p>In order to properly use User Protect, it\'s important to understand how the
module determines if a specified field is to be protected. Here is the basic
logic:</p>
<ol>
<li>If the current user is a user administrator, check if they have
per-administrator bypass settings. If so, then check to see if they are allowed
to bypass the protection. If so, then stop the checks and allow editing
of the field.</li>
<li>If not, then if the current user is a user administrator, check if the
default administrator bypass is enabled for the protection in question. If
so, then stop the checks and allow editing of the field.
<li>If not, check if the user is editing their own account. If so, determine
the protections for e-mail and password by examining the userprotect permissions
for \'change own e-mail\' and \'change own password\', and continue with the rest
of the checks below.
<li>If not, check if the protection is set for the individual user being edited.
If so, then stop the checks here, and prevent editing of the field (this effectively
means that individual protections override role protections).</li>
<li>If not, then examine all the roles for the user being edited. If any of
those roles have the protection enabled, then prevent editing of the field.</li>
<li>If not, then allow the field to be edited.</li>
</ol>
</p>', array(
'!admin_user' => l('mass user editing operations', 'admin/user/user'),
'!userprotect_settings' => l($admin . $pointer . $user_mgmt . $pointer . $userprotect, 'admin/user/userprotect/protected_users'),
'!protected_users' => l($admin . $pointer . $user_mgmt . $pointer . $userprotect . $pointer . $protected_users, 'admin/user/userprotect/protected_users'),
'!protected_roles' => l($admin . $pointer . $user_mgmt . $pointer . $userprotect . $pointer . $protected_roles, 'admin/user/userprotect/protected_roles'),
'!administrator_bypass' => l($admin . $pointer . $user_mgmt . $pointer . $userprotect . $pointer . $administrator_bypass, 'admin/user/userprotect/administrator_bypass'),
'!protection_defaults' => l($admin . $pointer . $user_mgmt . $pointer . $userprotect . $pointer . $protection_defaults, 'admin/user/userprotect/protection_defaults'),
'!roleassign' => l('RoleAssign', 'http://drupal.org/project/roleassign', array(
'target' => 'X',
), NULL, NULL, TRUE),
'!access_control' => l($admin . $pointer . $user_mgmt . $pointer . $access_control, 'admin/user/access'),
));
return $output;
}
}