public function CourseEnrollmentCreateAction::access in Course 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/Action/CourseEnrollmentCreateAction.php \Drupal\course\Plugin\Action\CourseEnrollmentCreateAction::access()
- 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\ActionCode
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;
}