class ViewsBulkOperationsAccess in Views Bulk Operations (VBO) 8
Same name and namespace in other branches
- 8.3 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess
- 8.2 src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess
- 4.0.x src/Access/ViewsBulkOperationsAccess.php \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess
Defines module access rules.
Hierarchy
- class \Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess implements AccessInterface
Expanded class hierarchy of ViewsBulkOperationsAccess
1 string reference to 'ViewsBulkOperationsAccess'
1 service uses ViewsBulkOperationsAccess
File
- src/
Access/ ViewsBulkOperationsAccess.php, line 14
Namespace
Drupal\views_bulk_operations\AccessView source
class ViewsBulkOperationsAccess implements AccessInterface {
/**
* Temporary user storage object.
*
* @var \Drupal\user\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();
$tempstore_name = 'views_bulk_operations_' . $parameters['view_id'] . '_' . $parameters['display_id'];
$view_data = $this->tempStoreFactory
->get($tempstore_name)
->get($account
->id());
if (!empty($view_data)) {
return AccessResult::allowed();
}
return AccessResult::forbidden();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ViewsBulkOperationsAccess:: |
protected | property | Temporary user storage object. | |
ViewsBulkOperationsAccess:: |
public | function | A custom access check. | |
ViewsBulkOperationsAccess:: |
public | function | Object constructor. |