class LogintobogganValidateAccess in LoginToboggan 8
Determines access to routes based on login status of current user.
Hierarchy
- class \Drupal\logintoboggan\Access\LogintobogganValidateAccess implements AccessInterface
Expanded class hierarchy of LogintobogganValidateAccess
1 string reference to 'LogintobogganValidateAccess'
1 service uses LogintobogganValidateAccess
File
- src/
Access/ LogintobogganValidateAccess.php, line 16
Namespace
Drupal\logintoboggan\AccessView source
class LogintobogganValidateAccess implements RoutingAccessInterface {
/**
* The time service.
*
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected $time;
/**
* Class constructor.
*/
public function __construct(Time $datetime) {
$this->time = $datetime;
}
/**
* {@inheritdoc}
*/
public function appliesTo() {
return [
'_logintoboggan_validate_email_access',
];
}
/**
* {@inheritdoc}
*/
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LogintobogganValidateAccess:: |
protected | property | The time service. | |
LogintobogganValidateAccess:: |
public | function | ||
LogintobogganValidateAccess:: |
public | function | ||
LogintobogganValidateAccess:: |
public | function | Class constructor. |