Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DbUpdateAccessCheck.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal