public function MongodbNodeGrantStorage::checkAll in MongoDB 8
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
- mongodb_node/
src/ MongodbNodeGrantStorage.php, line 107 - Contains \Drupal\node\NodeGrantDatabaseStorage.
Class
- MongodbNodeGrantStorage
- Defines a controller class that handles the node grants system.
Namespace
Drupal\mongodb_nodeCode
public function checkAll(AccountInterface $account) {
$query['nid'] = 0;
$query['grant.view']['$exists'] = TRUE;
$all_langcodes = $this->languageManager
->getLanguages();
$node_access_grants = node_access_grants('view', $account);
if ($grant_conditions = $this
->buildGrantsQueryCondition($node_access_grants, $all_langcodes)) {
$query['grant.view']['$in'] = $grant_conditions;
}
return $this->mongo
->get('entity.node')
->find($query)
->count();
}