class NodeAuthlinkGroupContentAccessControlHandler in Node authorize link 8
Class NodeAuthlinkGroupContentAccessControlHandler.
@package Drupal\node_authlink\Access
Hierarchy
- class \Drupal\group\Plugin\GroupContentHandlerBase implements GroupContentHandlerInterface
- class \Drupal\group\Plugin\GroupContentAccessControlHandler implements GroupContentAccessControlHandlerInterface
- class \Drupal\node_authlink\Plugin\NodeAuthlinkGroupContentAccessControlHandler
- class \Drupal\group\Plugin\GroupContentAccessControlHandler implements GroupContentAccessControlHandlerInterface
Expanded class hierarchy of NodeAuthlinkGroupContentAccessControlHandler
1 file declares its use of NodeAuthlinkGroupContentAccessControlHandler
- node_authlink.module in ./
node_authlink.module - Node Authlink hooks and alters.
File
- src/
Access/ NodeAuthlinkGroupContentAccessControlHandler.php, line 16
Namespace
Drupal\node_authlink\PluginView source
class NodeAuthlinkGroupContentAccessControlHandler extends GroupContentAccessControlHandler {
/**
* {@inheritdoc}
*/
public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account, $return_as_object = FALSE) {
$authkey = \Drupal::request()
->get('authkey');
// TODO: generalize to any content entity.
if (!empty($authkey) && $entity instanceof NodeInterface) {
if (node_authlink_check_authlink($entity, $operation, $account)) {
return $return_as_object ? AccessResult::allowed()
->addCacheContexts([
'url.query_args:authkey',
]) : TRUE;
}
}
return parent::entityAccess($entity, $operation, $account, $return_as_object);
}
}