Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NodeAccessControlHandler.php

function NodeAccessControlHandler::acquireGrants

Overrides NodeAccessControlHandlerInterface::acquireGrants

File

core/modules/node/src/NodeAccessControlHandler.php, line 272

Class

NodeAccessControlHandler
Defines the access control handler for the node entity type.

Namespace

Drupal\node

Code

public function acquireGrants(NodeInterface $node) {
    $grants = $this->moduleHandler
        ->invokeAll('node_access_records', [
        $node,
    ]);
    // Let modules alter the grants.
    $this->moduleHandler
        ->alter('node_access_records', $grants, $node);
    // If no grants are set and the node is published, then use the default grant.
    if (empty($grants) && $node->isPublished()) {
        $grants[] = [
            'realm' => 'all',
            'gid' => 0,
            'grant_view' => 1,
            'grant_update' => 0,
            'grant_delete' => 0,
        ];
    }
    return $grants;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal