public function DeleteMultiple::access in Log entity 8
Checks access to the form.
Parameters
\Drupal\Core\Session\AccountInterface $account: The account to check access for.
Return value
\Drupal\Core\Access\AccessResult The access result.
1 string reference to 'DeleteMultiple::access'
File
- src/
Form/ DeleteMultiple.php, line 70 - Contains \Drupal\log\Form\DeleteMultiple.
Class
- DeleteMultiple
- Provides a log deletion confirmation form.
Namespace
Drupal\log\FormCode
public function access(AccountInterface $account) {
/** @var LogTypeInterface $type */
foreach (LogType::loadMultiple() as $type) {
// If the user has either access to deleting own log entities, or access
// to deleting all entities in at least one type, they should be able to
// access the bulk confirm form. If they for some reason try to go there
// to delete one they don't have access to, the entity access will forbid
// it anyway.
if ($account
->hasPermission('delete own ' . $type
->id() . ' log entities') || $account
->hasPermission('delete any ' . $type
->id() . ' log entities')) {
return AccessResult::allowed();
}
}
// In addition we grant access if the user can administer log entities.
if ($account
->hasPermission('administer logs')) {
return AccessResult::allowed();
}
// If none of the above, the user is not allowed access.
return AccessResult::forbidden();
}