function _views_bulk_operations_action_permission in Views Bulk Operations (VBO) 6
Same name and namespace in other branches
- 6.3 views_bulk_operations.module \_views_bulk_operations_action_permission()
Helper function to verify access permission to execute operation.
2 calls to _views_bulk_operations_action_permission()
- _views_bulk_operations_action_aggregate_do in ./
views_bulk_operations.module - Helper function to execute an aggregate operation.
- _views_bulk_operations_action_do in ./
views_bulk_operations.module - Helper function to execute one operation.
File
- ./
views_bulk_operations.module, line 1886 - Allows operations to be performed on items selected in a view.
Code
function _views_bulk_operations_action_permission($operation, $account = NULL) {
if (module_exists('actions_permissions')) {
$perm = actions_permissions_get_perm($operation['perm label'], $operation['callback']);
if (!user_access($perm, $account)) {
global $user;
watchdog('vbo', 'An attempt by user %user to !perm was blocked due to insufficient permissions.', array(
'!perm' => $perm,
'%user' => isset($account) ? $account->name : $user->name,
), WATCHDOG_ALERT);
drupal_access_denied();
exit;
}
}
// Check against additional permissions.
if (!empty($operation['permissions'])) {
foreach ($operation['permissions'] as $perm) {
if (!user_access($perm, $account)) {
global $user;
watchdog('vbo', 'An attempt by user %user to !perm was blocked due to insufficient permissions.', array(
'!perm' => $perm,
'%user' => isset($account) ? $account->name : $user->name,
), WATCHDOG_ALERT);
drupal_access_denied();
exit;
}
}
}
}