You are here

public function CourseEnrollmentCreateAction::access in Course 8.2

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

File

src/Plugin/Action/CourseEnrollmentCreateAction.php, line 39

Class

CourseEnrollmentCreateAction
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;
}