You are here

class DbUpdateAccessCheck in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Access/DbUpdateAccessCheck.php \Drupal\system\Access\DbUpdateAccessCheck
  2. 9 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

Namesort descending Modifiers Type Description Overrides
DbUpdateAccessCheck::access public function Checks access for update routes.