protected function MeetingResultAccessControlHandler::checkAccess in Opigno Moxtra 3.x
Same name and namespace in other branches
- 8 src/MeetingResultAccessControlHandler.php \Drupal\opigno_moxtra\MeetingResultAccessControlHandler::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/
MeetingResultAccessControlHandler.php, line 20
Class
- MeetingResultAccessControlHandler
- Access controller for the opigno_moxtra_meeting_result entity.
Namespace
Drupal\opigno_moxtraCode
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
if ($account
->hasPermission('manage group content in any group')) {
return AccessResult::allowed();
}
/** @var \Drupal\opigno_moxtra\MeetingInterface $entity */
switch ($operation) {
case 'view':
return AccessResult::allowedIfHasPermission($account, 'view meeting result entities');
case 'edit':
return AccessResult::allowedIfHasPermission($account, 'edit meeting result entities');
case 'delete':
return AccessResult::allowedIfHasPermission($account, 'delete meeting result entities');
}
return AccessResult::allowed();
}