You are here

public function PreviewLinkSessionExistsAccessCheck::access in Preview Link 2.0.x

Same name and namespace in other branches
  1. 2.x src/Access/PreviewLinkSessionExistsAccessCheck.php \Drupal\preview_link\Access\PreviewLinkSessionExistsAccessCheck::access()

Checks whether the user has a session.

Parameters

\Symfony\Component\HttpFoundation\Request|null $request: The request, if available.

Return value

\Drupal\Core\Access\AccessResultInterface Whether the user has a session.

File

src/Access/PreviewLinkSessionExistsAccessCheck.php, line 44

Class

PreviewLinkSessionExistsAccessCheck
Checks whether the user has a session.

Namespace

Drupal\preview_link\Access

Code

public function access(Request $request = NULL) : AccessResultInterface {
  return AccessResult::allowedIf($request ? $this->sessionConfiguration
    ->hasSession($request) : FALSE)
    ->addCacheContexts([
    'session.exists',
  ]);
}