class DbUpdateAccessCheck

Same name in other branches
  1. 9 core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck
  2. 8.9.x core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck
  3. 10 core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck

Access check for database update routes.

Hierarchy

Expanded class hierarchy of DbUpdateAccessCheck

1 string reference to 'DbUpdateAccessCheck'
system.services.yml in core/modules/system/system.services.yml
core/modules/system/system.services.yml
1 service uses DbUpdateAccessCheck
access_check.db_update in core/modules/system/system.services.yml
Drupal\system\Access\DbUpdateAccessCheck

File

core/modules/system/src/Access/DbUpdateAccessCheck.php, line 13

Namespace

Drupal\system\Access
View source
class DbUpdateAccessCheck implements AccessInterface {
    
    /**
     * Checks access for update routes.
     *
     * @param \Drupal\Core\Session\AccountInterface $account
     *   The currently logged in account.
     *
     * @return \Drupal\Core\Access\AccessResultInterface
     *   The access result.
     */
    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();
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
DbUpdateAccessCheck::access public function Checks access for update routes.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.