class RegisterAccessCheck

Same name in other branches
  1. 9 core/modules/user/src/Access/RegisterAccessCheck.php \Drupal\user\Access\RegisterAccessCheck
  2. 8.9.x core/modules/user/src/Access/RegisterAccessCheck.php \Drupal\user\Access\RegisterAccessCheck
  3. 10 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

Title Sort descending Modifiers Object type Summary
RegisterAccessCheck::access public function Checks access.

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