You are here

public function UnmasqueradeAccessCheck::access in Masquerade 8.2

Check to see if user is masquerading.

Return value

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

File

src/Access/UnmasqueradeAccessCheck.php, line 37

Class

UnmasqueradeAccessCheck
Checks access based on the masquerade status of the user.

Namespace

Drupal\masquerade\Access

Code

public function access() {
  return AccessResult::allowedIf($this->masquerade
    ->isMasquerading())
    ->addCacheContexts([
    'session.is_masquerading',
  ]);
}