public function AccessStorage::getGids in Permissions by Term 8
Same name and namespace in other branches
- 8.2 src/Service/AccessStorage.php \Drupal\permissions_by_term\Service\AccessStorage::getGids()
Parameters
AccountInterface $user:
Return value
array
File
- src/
Service/ AccessStorage.php, line 622
Class
- AccessStorage
- Class AccessStorage.
Namespace
Drupal\permissions_by_term\ServiceCode
public function getGids(AccountInterface $user) {
$grants = null;
if (!empty($permittedNids = $this
->computePermittedTids($user))) {
$query = $this->database
->select('node_access', 'na')
->fields('na', [
'gid',
])
->condition('na.nid', $permittedNids, 'IN')
->condition('na.realm', self::NODE_ACCESS_REALM);
$gids = $query
->execute()
->fetchCol();
foreach ($gids as $gid) {
$grants[self::NODE_ACCESS_REALM][] = $gid;
}
}
return $grants;
}