You are here

public function DbUpdateAccessCheck::access in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

string A \Drupal\Core\Access\AccessInterface constant value.

File

core/modules/system/src/Access/DbUpdateAccessCheck.php, line 29
Contains \Drupal\system\Access\DbUpdateAccessCheck.

Class

DbUpdateAccessCheck
Access check for database update routes.

Namespace

Drupal\system\Access

Code

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();
  }
}