class UnmasqueradeAccessCheck in Masquerade 8.2
Checks access based on the masquerade status of the user.
Hierarchy
- class \Drupal\masquerade\Access\UnmasqueradeAccessCheck implements AccessInterface
Expanded class hierarchy of UnmasqueradeAccessCheck
1 string reference to 'UnmasqueradeAccessCheck'
1 service uses UnmasqueradeAccessCheck
File
- src/
Access/ UnmasqueradeAccessCheck.php, line 12
Namespace
Drupal\masquerade\AccessView source
class UnmasqueradeAccessCheck implements AccessInterface {
/**
* The masquerade service.
*
* @var \Drupal\masquerade\Masquerade
*/
protected $masquerade;
/**
* Constructs a new UnmasqueradeAccessCheck object.
*
* @param \Drupal\masquerade\Masquerade $masquerade
* The masquerade service.
*/
public function __construct(Masquerade $masquerade) {
$this->masquerade = $masquerade;
}
/**
* Check to see if user is masquerading.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access() {
return AccessResult::allowedIf($this->masquerade
->isMasquerading())
->addCacheContexts([
'session.is_masquerading',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UnmasqueradeAccessCheck:: |
protected | property | The masquerade service. | |
UnmasqueradeAccessCheck:: |
public | function | Check to see if user is masquerading. | |
UnmasqueradeAccessCheck:: |
public | function | Constructs a new UnmasqueradeAccessCheck object. |