WorkspaceAccessControlHandler.php
Namespace
Drupal\workspacesFile
-
core/
modules/ workspaces/ src/ WorkspaceAccessControlHandler.php
View source
<?php
namespace Drupal\workspaces;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Defines the access control handler for the workspace entity type.
*
* @see \Drupal\workspaces\Entity\Workspace
*/
class WorkspaceAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
assert($entity instanceof WorkspaceInterface);
// Delegate access checking to the workspace provider.
return $entity->getProvider()
->checkAccess($entity, $operation, $account);
}
/**
* {@inheritdoc}
*/
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
return AccessResult::allowedIfHasPermissions($account, [
'administer workspaces',
'create workspace',
], 'OR');
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| WorkspaceAccessControlHandler | Defines the access control handler for the workspace entity type. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.