You are here

public function LockableConfigEntityAccessControlHandler::checkAccess in Simple OAuth (OAuth2) & OpenID Connect 8

Same name and namespace in other branches
  1. 8.4 src/LockableConfigEntityAccessControlHandler.php \Drupal\simple_oauth\LockableConfigEntityAccessControlHandler::checkAccess()
  2. 8.2 src/LockableConfigEntityAccessControlHandler.php \Drupal\simple_oauth\LockableConfigEntityAccessControlHandler::checkAccess()
  3. 8.3 src/LockableConfigEntityAccessControlHandler.php \Drupal\simple_oauth\LockableConfigEntityAccessControlHandler::checkAccess()
  4. 5.x src/LockableConfigEntityAccessControlHandler.php \Drupal\simple_oauth\LockableConfigEntityAccessControlHandler::checkAccess()

Performs access checks.

This method is supposed to be overwritten by extending classes that do their own custom access checking.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check access.

string $operation: The entity operation. Usually one of 'view', 'view label', 'update' or 'delete'.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides EntityAccessControlHandler::checkAccess

File

src/LockableConfigEntityAccessControlHandler.php, line 15

Class

LockableConfigEntityAccessControlHandler

Namespace

Drupal\simple_oauth

Code

public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($operation == 'view') {

    // Allow viewing the configuration entity.
    return AccessResult::allowed();
  }
  if ($entity
    ->isLocked()) {
    return AccessResult::forbidden();
  }
  return parent::checkAccess($entity, $operation, $account);
}