class ReplicateAccessChecker in Replicate UI 8
Access checker which checks entity create/view access as well a permission.
Hierarchy
- class \Drupal\replicate_ui\ReplicateAccessChecker implements AccessInterface
Expanded class hierarchy of ReplicateAccessChecker
1 string reference to 'ReplicateAccessChecker'
1 service uses ReplicateAccessChecker
File
- src/
ReplicateAccessChecker.php, line 15
Namespace
Drupal\replicate_uiView source
class ReplicateAccessChecker implements AccessInterface {
/**
* @var \Drupal\user\Access\PermissionAccessCheck
*/
protected $permAccessChecker;
/**
* @var \Drupal\Core\Entity\EntityAccessCheck
*/
protected $entityAccessChecker;
/**
* Creates a new ReplicateAccessChecker instance.
*
* @param \Drupal\user\Access\PermissionAccessCheck $permAccessChecker
* @param \Drupal\Core\Entity\EntityAccessCheck $entityAccessChecker
*/
public function __construct(PermissionAccessCheck $permAccessChecker, EntityAccessCheck $entityAccessChecker) {
$this->permAccessChecker = $permAccessChecker;
$this->entityAccessChecker = $entityAccessChecker;
}
public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) {
$create_fake_route = clone $route;
$create_fake_route
->setRequirement('_entity_access', $route
->getDefault('entity_type_id') . '.create');
$view_fake_route = clone $route;
$view_fake_route
->setRequirement('_entity_access', $route
->getDefault('entity_type_id') . '.create');
$permission_fake_route = clone $route;
$permission_fake_route
->setRequirements([
'_permission' => 'replicate entities',
]);
return $this->entityAccessChecker
->access($view_fake_route, $route_match, $account)
->andIf($this->entityAccessChecker
->access($create_fake_route, $route_match, $account))
->andIf($this->permAccessChecker
->access($permission_fake_route, $account));
}
/**
* {@inheritdoc}
*/
public function applies(Route $route) {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ReplicateAccessChecker:: |
protected | property | ||
ReplicateAccessChecker:: |
protected | property | ||
ReplicateAccessChecker:: |
public | function | ||
ReplicateAccessChecker:: |
public | function | ||
ReplicateAccessChecker:: |
public | function | Creates a new ReplicateAccessChecker instance. |