NodeGrantDatabaseStorage::checkAll

public NodeGrantDatabaseStorage::checkAll(AccountInterface $account)

Checks all grants for a given account.

Parameters

\Drupal\Core\Session\AccountInterface $account: A user object representing the user for whom the operation is to be performed.

Return value

int. Status of the access check.

Overrides NodeGrantDatabaseStorageInterface::checkAll

File

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

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 = static::buildGrantsQueryCondition(node_access_grants('view', $account));

  if (count($grants) > 0) {
    $query->condition($grants);
  }
  return $query->execute()->fetchField();
}
doc_Drupal
2016-10-29 09:30:48
Comments
Leave a Comment

Please login to continue.