function DbUpdateAccessCheck::access
Same name in other branches
- 8.9.x core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck::access()
- 10 core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck::access()
- 11.x core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck::access()
Checks access for update routes.
Parameters
\Drupal\Core\Session\AccountInterface $account: The currently logged in account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
-
core/
modules/ system/ src/ Access/ DbUpdateAccessCheck.php, line 24
Class
- DbUpdateAccessCheck
- Access check for database update routes.
Namespace
Drupal\system\AccessCode
public function access(AccountInterface $account) {
// Allow the global variable in settings.php to override the access check.
if (Settings::get('update_free_access')) {
return AccessResult::allowed()->setCacheMaxAge(0);
}
if ($account->hasPermission('administer software updates')) {
return AccessResult::allowed()->cachePerPermissions();
}
else {
return AccessResult::forbidden()->cachePerPermissions();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.