You are here

public function CourseEnrollmentEditAction::access in Course 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/Action/CourseEnrollmentEditAction.php \Drupal\course\Plugin\Action\CourseEnrollmentEditAction::access()
  2. 3.x src/Plugin/Action/CourseEnrollmentEditAction.php \Drupal\course\Plugin\Action\CourseEnrollmentEditAction::access()

File

src/Plugin/Action/CourseEnrollmentEditAction.php, line 109

Class

CourseEnrollmentEditAction
Action description.

Namespace

Drupal\course\Plugin\Action

Code

public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
  if ($object
    ->getEntityType() === 'user') {
    $access = $object
      ->access('update', $account, TRUE)
      ->andIf($object->status
      ->access('edit', $account, TRUE));
    return $return_as_object ? $access : $access
      ->isAllowed();
  }

  // Other entity types may have different
  // access methods and properties.
  return TRUE;
}