You are here

class NodeAuthlinkGroupContentAccessControlHandler in Node authorize link 8

Class NodeAuthlinkGroupContentAccessControlHandler.

@package Drupal\node_authlink\Access

Hierarchy

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\Plugin
View 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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GroupContentAccessControlHandler::$entityTypeManager protected property The entity type manager.
GroupContentAccessControlHandler::$permissionProvider protected property The plugin's permission provider.
GroupContentAccessControlHandler::combinedPermissionCheck protected function Checks the provided permission alongside the admin permission.
GroupContentAccessControlHandler::createInstance public static function Instantiates a new instance of this group content handler. Overrides GroupContentHandlerBase::createInstance
GroupContentAccessControlHandler::entityCreateAccess public function Checks access to create an entity. Overrides GroupContentAccessControlHandlerInterface::entityCreateAccess
GroupContentAccessControlHandler::relationAccess public function Checks access to an operation on the relation. Overrides GroupContentAccessControlHandlerInterface::relationAccess
GroupContentAccessControlHandler::relationCreateAccess public function Checks access to create a relation. Overrides GroupContentAccessControlHandlerInterface::relationCreateAccess
GroupContentHandlerBase::$definition protected property The group content enabler definition.
GroupContentHandlerBase::$moduleHandler protected property The module handler to invoke hooks on.
GroupContentHandlerBase::$pluginId protected property The plugin ID as read from the definition.
GroupContentHandlerBase::moduleHandler protected function Gets the module handler.
GroupContentHandlerBase::setModuleHandler public function Sets the module handler for this handler.
GroupContentHandlerBase::__construct public function Constructs a GroupContentHandlerBase object.
NodeAuthlinkGroupContentAccessControlHandler::entityAccess public function Checks access to an operation on the entity. Overrides GroupContentAccessControlHandler::entityAccess