Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / user / src / Access / RegisterAccessCheck.php
1 <?php
2
3 namespace Drupal\user\Access;
4
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Routing\Access\AccessInterface;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10  * Access check for user registration routes.
11  */
12 class RegisterAccessCheck implements AccessInterface {
13
14   /**
15    * Checks access.
16    *
17    * @param \Drupal\Core\Session\AccountInterface $account
18    *   The currently logged in account.
19    *
20    * @return \Drupal\Core\Access\AccessResultInterface
21    *   The access result.
22    */
23   public function access(AccountInterface $account) {
24     $user_settings = \Drupal::config('user.settings');
25     return AccessResult::allowedIf($account->isAnonymous() && $user_settings->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY)->cacheUntilConfigurationChanges($user_settings);
26   }
27
28 }