You are here

protected function CourseAccessControlHandler::checkAccess in Course 8.3

Same name and namespace in other branches
  1. 8.2 src/Access/CourseAccessControlHandler.php \Drupal\course\Access\CourseAccessControlHandler::checkAccess()
  2. 3.x src/Access/CourseAccessControlHandler.php \Drupal\course\Access\CourseAccessControlHandler::checkAccess()

Link the activities to the permissions. checkAccess is called with the $operation as defined in the routing.yml file.

Overrides EntityAccessControlHandlerBase::checkAccess

File

src/Access/CourseAccessControlHandler.php, line 24

Class

CourseAccessControlHandler
Access controller for the Course entity.

Namespace

Drupal\course\Access

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($operation == 'edit') {
    return AccessResult::allowedIfHasPermission($account, 'administer course');
  }
  else {
    return parent::checkAccess($entity, $operation, $account);
  }
}