You are here

public function Domain301RedirectController::access in Domain 301 Redirect 8

Checks access for a specific request.

Parameters

\Drupal\Core\Session\AccountInterface $account: The current user account.

Return value

\Drupal\Core\Access\AccessResult The access result.

1 string reference to 'Domain301RedirectController::access'
domain_301_redirect.routing.yml in ./domain_301_redirect.routing.yml
domain_301_redirect.routing.yml

File

src/Controller/Domain301RedirectController.php, line 86

Class

Domain301RedirectController
Controller to check that the domain is working.

Namespace

Drupal\domain_301_redirect\Controller

Code

public function access(AccountInterface $account) {
  $token = $this->redirectManager
    ->getRedirectCheckToken();
  if ($this->request->query
    ->get('token') == $token) {
    return AccessResult::allowed();
  }
  return AccessResult::forbidden();
}