public function SimpleAccessGroup::buildGrant in Simple Access 8.3
Build list of grants to be as part of the content selection.
Parameters
\Drupal\user\UserInterface|null $account: Account of the user to generate access for.
string $op: Operation which is being queried.
Return value
array A list of all the grants to be used.
Overrides SimpleAccessGroupInterface::buildGrant
File
- src/
Entity/ SimpleAccessGroup.php, line 117
Class
- SimpleAccessGroup
- Defines the SimpleAccessGroup configuration entity class.
Namespace
Drupal\simple_access\EntityCode
public function buildGrant(AccountInterface $account, $op) {
foreach (array_filter($this->roles) as $rid) {
if ($this->id == 'owner' || in_array($rid, $account
->getRoles())) {
return [
'simple_access_group:' . $this
->id() => [
$this->id == 'owner' ? $account
->id() : '0',
],
];
}
}
}