class QuickNodeCloneNodeAccess in Quick Node Clone 8
Access control for cloning nodes.
Hierarchy
- class \Drupal\quick_node_clone\Controller\QuickNodeCloneNodeAccess
Expanded class hierarchy of QuickNodeCloneNodeAccess
File
- src/
Controller/ QuickNodeCloneNodeAccess.php, line 12
Namespace
Drupal\quick_node_clone\ControllerView source
class QuickNodeCloneNodeAccess {
/**
* Limit access to the clone according to their restricted state.
*
* @param \Drupal\Core\Session\AccountInterface $account
* The account object.
* @param int $node
* The node id.
*
* @return \Drupal\Core\Access\AccessResultAllowed|\Drupal\Core\Access\AccessResultForbidden
* If allowed, AccessResultAllowed isAllowed() will be TRUE. If forbidden,
* isForbidden() will be TRUE.
*/
public function cloneNode(AccountInterface $account, $node) {
$node = Node::load($node);
if (_quick_node_clone_has_clone_permission($node)) {
$result = AccessResult::allowed();
}
else {
$result = AccessResult::forbidden();
}
$result
->addCacheableDependency($node);
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QuickNodeCloneNodeAccess:: |
public | function | Limit access to the clone according to their restricted state. |