You are here

public function ViewsBulkOperationsAction::access in Views Bulk Operations (VBO) 7.3

Returns whether the provided account has access to execute the operation.

Parameters

$account:

Overrides ViewsBulkOperationsBaseOperation::access

File

plugins/operation_types/action.class.php, line 48
Defines the class for core actions. Belongs to the "action" operation type plugin.

Class

ViewsBulkOperationsAction
@file Defines the class for core actions. Belongs to the "action" operation type plugin.

Code

public function access($account) {

  // Use actions_permissions if enabled.
  if (module_exists('actions_permissions')) {
    $perm = actions_permissions_get_perm($this->operationInfo['label'], $this->operationInfo['key']);
    if (!user_access($perm, $account)) {
      return FALSE;
    }
  }

  // Check against additional permissions.
  if (!empty($this->operationInfo['permissions'])) {
    foreach ($this->operationInfo['permissions'] as $perm) {
      if (!user_access($perm, $account)) {
        return FALSE;
      }
    }
  }

  // Access granted.
  return TRUE;
}