class LogintobogganReValidateAccess in LoginToboggan 8
Determines access to routes based on login status of current user.
Hierarchy
- class \Drupal\logintoboggan\Access\LogintobogganReValidateAccess implements AccessInterface
Expanded class hierarchy of LogintobogganReValidateAccess
1 string reference to 'LogintobogganReValidateAccess'
1 service uses LogintobogganReValidateAccess
File
- src/
Access/ LogintobogganReValidateAccess.php, line 15
Namespace
Drupal\logintoboggan\AccessView source
class LogintobogganReValidateAccess implements RoutingAccessInterface {
/**
* {@inheritdoc}
*/
public function appliesTo() {
return [
'_logintoboggan_revalidate_access',
];
}
/**
* {@inheritdoc}
*/
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
$fullpath = Url::fromRoute('<current>')
->toString();
$path_parts = explode('/', $fullpath);
$user_id = $path_parts[3];
return $account
->id() == $user_id || $account
->hasPermission('administer users') ? AccessResult::allowed() : AccessResult::forbidden();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LogintobogganReValidateAccess:: |
public | function | ||
LogintobogganReValidateAccess:: |
public | function |