function hook_workbench_access_user_alter in Workbench Access 7
Allows modules to alter user privileges.
Standard drupal_alter() hook to allow modules to modify the sections that a user is allowed to edit. This hook is largely present to allow for complex handling of content type permissions.
Parameters
&$access: An array of access data, keyed by the access id. Passed by reference.
$account: The active user account object. Note that this object may also be altered, since objects are implicitly passed by reference. Normally, you should not alter the $account object with this hook.
1 invocation of hook_workbench_access_user_alter()
- workbench_access_user_load_data in ./
workbench_access.module - Load the access data for this user.
File
- ./
workbench_access.api.php, line 529 - API documentation file for Workbench Access.
Code
function hook_workbench_access_user_alter(&$access, $account) {
// Make content editing specific to assigned node types.
if (empty($account->workbench_access)) {
return;
}
$types = node_type_get_types();
foreach ($access as $id => $data) {
$access[$id]['update'] = array();
foreach ($types as $type => $value) {
if (user_access("edit any {$type} content", $account)) {
$access[$id]['update'][] = $type;
}
}
}
}