function secure_permissions_secure_permissions in Secure Permissions 6
Same name and namespace in other branches
- 7.2 secure_permissions.module \secure_permissions_secure_permissions()
- 7 secure_permissions.module \secure_permissions_secure_permissions()
Implement hook_secure_permissions().
If configured to do so, this function will restore the default site permissions that ship with Drupal. It will also maintain an administrative role that has all permissions.
Important: If you use this module, you must implement this hook in your own code, or else risk having permissions reset.
File
- ./
secure_permissions.module, line 217 - Secure Permissions module file.
Code
function secure_permissions_secure_permissions($role) {
$permissions = array();
// Use the default permissions granted by Drupal core?
if (secure_permissions_variable('secure_permissions_use_default')) {
$permissions['anonymous user'] = array(
'access content',
);
$permissions['authenticated user'] = array(
'access comments',
'access content',
'post comments',
'post comments without approval',
);
}
// Add all permissions to the administrative role?
if ($role == secure_permissions_variable('secure_permissions_role_name') && secure_permissions_variable('secure_permissions_administrative_role')) {
$permissions[$role] = array_values(module_invoke_all('perm'));
}
// Return the permissions.
if (isset($permissions[$role])) {
return $permissions[$role];
}
}