You are here

public function LogintobogganValidateAccess::access in LoginToboggan 8

File

src/Access/LogintobogganValidateAccess.php, line 42

Class

LogintobogganValidateAccess
Determines access to routes based on login status of current user.

Namespace

Drupal\logintoboggan\Access

Code

public function access(Route $route, Request $request, AccountInterface $account) {
  $path = Url::fromRoute('<current>')
    ->toString();
  $arg = explode('/', $path);
  $request_time = $this->time
    ->getRequestTime();
  return $arg[4] < $request_time ? AccessResult::allowed() : AccessResult::forbidden();
}