You are here

protected function EntityAccess::bypassAccessResult in Workspace 8

Same name and namespace in other branches
  1. 8.2 src/EntityAccess.php \Drupal\workspace\EntityAccess::bypassAccessResult()

Parameters

\Drupal\Core\Session\AccountInterface $account:

Return value

\Drupal\Core\Access\AccessResult

2 calls to EntityAccess::bypassAccessResult()
EntityAccess::entityAccess in src/EntityAccess.php
Hook bridge.
EntityAccess::entityCreateAccess in src/EntityAccess.php
Hook bridge.

File

src/EntityAccess.php, line 98

Class

EntityAccess
Service wrapper for hooks relating to entity access control.

Namespace

Drupal\workspace

Code

protected function bypassAccessResult(AccountInterface $account) {

  // This approach assumes that the current "global" active workspace is
  // correct, ie, if you're "in" a given workspace then you get ALL THE PERMS
  // to ALL THE THINGS! That's why this is a dangerous permission.
  $active_workspace = $this->workspaceManager
    ->getActiveWorkspace();
  return AccessResult::allowedIfHasPermission($account, 'bypass_entity_access_workspace_' . $active_workspace
    ->id())
    ->orIf(AccessResult::allowedIf($active_workspace
    ->getOwnerId() == $account
    ->id())
    ->andIf(AccessResult::allowedIfHasPermission($account, 'bypass_entity_access_own_workspace')));
}