You are here

class RegisterAccessCheck in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/Access/RegisterAccessCheck.php \Drupal\user\Access\RegisterAccessCheck
  2. 9 core/modules/user/src/Access/RegisterAccessCheck.php \Drupal\user\Access\RegisterAccessCheck

Access check for user registration routes.

Hierarchy

Expanded class hierarchy of RegisterAccessCheck

1 string reference to 'RegisterAccessCheck'
user.services.yml in core/modules/user/user.services.yml
core/modules/user/user.services.yml
1 service uses RegisterAccessCheck
access_check.user.register in core/modules/user/user.services.yml
Drupal\user\Access\RegisterAccessCheck

File

core/modules/user/src/Access/RegisterAccessCheck.php, line 13

Namespace

Drupal\user\Access
View source
class RegisterAccessCheck implements AccessInterface {

  /**
   * Checks access.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The currently logged in account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(AccountInterface $account) {
    $user_settings = \Drupal::config('user.settings');
    return AccessResult::allowedIf($account
      ->isAnonymous() && $user_settings
      ->get('register') != UserInterface::REGISTER_ADMINISTRATORS_ONLY)
      ->addCacheableDependency($user_settings);
  }

}

Members