private function AccessStorage::computePermittedTids in Permissions by Term 8
Same name and namespace in other branches
- 8.2 src/Service/AccessStorage.php \Drupal\permissions_by_term\Service\AccessStorage::computePermittedTids()
1 call to AccessStorage::computePermittedTids()
- AccessStorage::getGids in src/
Service/ AccessStorage.php
File
- src/
Service/ AccessStorage.php, line 642
Class
- AccessStorage
- Class AccessStorage.
Namespace
Drupal\permissions_by_term\ServiceCode
private function computePermittedTids(AccountInterface $user) {
$nidsWithNoTidRestriction = $this
->getUnrestrictedNids();
$nidsByTids = $this->term
->getNidsByTids($this
->getPermittedTids($user
->id(), $user
->getRoles()));
if (\Drupal::config('permissions_by_term.settings.single_term_restriction')
->get('value')) {
$permittedNids = [];
foreach ($nidsByTids as $nid) {
if ($this->accessCheck
->canUserAccessByNodeId($nid, $user
->id(), $this
->getLangCode($nid))) {
$permittedNids[] = $nid;
}
}
$nidsByTids = $permittedNids;
}
if (!empty($nidsByTids)) {
return array_merge($this
->getUnrestrictedNids(), $nidsByTids);
}
return $nidsWithNoTidRestriction;
}