Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function blockAccess(AccountInterface $account)
 {
     if ($this->masquerade->isMasquerading()) {
         return AccessResult::forbidden()->addCacheContexts(['is_masquerading']);
     }
     // Display block for all users that has any of masquerade permissions.
     return AccessResult::allowedIfHasPermissions($account, $this->masquerade->getPermissions(), 'OR');
 }
 /**
  * Check to see if user is masquerading.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access()
 {
     return AccessResult::allowedIf($this->masquerade->isMasquerading())->addCacheContexts(['is_masquerading']);
 }