function NodeGrantDatabaseStorage::checkAll

Same name in other branches
  1. 9 core/modules/node/src/NodeGrantDatabaseStorage.php \Drupal\node\NodeGrantDatabaseStorage::checkAll()
  2. 8.9.x core/modules/node/src/NodeGrantDatabaseStorage.php \Drupal\node\NodeGrantDatabaseStorage::checkAll()
  3. 11.x core/modules/node/src/NodeGrantDatabaseStorage.php \Drupal\node\NodeGrantDatabaseStorage::checkAll()

File

core/modules/node/src/NodeGrantDatabaseStorage.php, line 137

Class

NodeGrantDatabaseStorage
Defines a storage handler class that handles the node grants system.

Namespace

Drupal\node

Code

public function checkAll(AccountInterface $account) {
    $query = $this->database
        ->select('node_access');
    $query->addExpression('COUNT(*)');
    $query->condition('nid', 0)
        ->condition('grant_view', 1, '>=');
    $grants = $this->buildGrantsQueryCondition(node_access_grants('view', $account));
    if (count($grants) > 0) {
        $query->condition($grants);
    }
    return $query->execute()
        ->fetchField();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.