You are here

class ViewsBulkOperationsAccess in Views Bulk Operations (VBO) 8.2

Same name and namespace in other branches
  1. 8.3 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess
  2. 8 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess
  3. 4.0.x src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess

Defines module access rules.

Hierarchy

Expanded class hierarchy of ViewsBulkOperationsAccess

1 string reference to 'ViewsBulkOperationsAccess'
views_bulk_operations.services.yml in ./views_bulk_operations.services.yml
views_bulk_operations.services.yml
1 service uses ViewsBulkOperationsAccess
views_bulk_operations.access in ./views_bulk_operations.services.yml
Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess

File

src/Access/ViewsBulkOperationsAccess.php, line 15

Namespace

Drupal\views_bulk_operations\Access
View source
class ViewsBulkOperationsAccess implements AccessInterface {

  /**
   * Temporary user storage object.
   *
   * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
   */
  protected $tempStoreFactory;

  /**
   * Object constructor.
   */
  public function __construct(PrivateTempStoreFactory $tempStoreFactory) {
    $this->tempStoreFactory = $tempStoreFactory;
  }

  /**
   * A custom access check.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   * @param \Drupal\Core\Routing\RouteMatch $routeMatch
   *   The matched route.
   */
  public function access(AccountInterface $account, RouteMatch $routeMatch) {
    $parameters = $routeMatch
      ->getParameters()
      ->all();
    if ($view = Views::getView($parameters['view_id'])) {
      if ($view
        ->access($parameters['display_id'], $account)) {
        return AccessResult::allowed();
      }
    }
    return AccessResult::forbidden();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ViewsBulkOperationsAccess::$tempStoreFactory protected property Temporary user storage object.
ViewsBulkOperationsAccess::access public function A custom access check.
ViewsBulkOperationsAccess::__construct public function Object constructor.