function tac_lite_node_grants in Taxonomy Access Control Lite 8
Same name and namespace in other branches
- 5 tac_lite.module \tac_lite_node_grants()
- 6 tac_lite.module \tac_lite_node_grants()
- 7 tac_lite.module \tac_lite_node_grants()
Implements hook_node_grants().
Returns any grants which may give the user permission to perform the requested op.
File
- ./
tac_lite.module, line 157 - Control access to site content based on taxonomy, roles and users.
Code
function tac_lite_node_grants(AccountInterface $account, $op) {
$grants = [];
$settings = \Drupal::config('tac_lite.settings');
$schemes = $settings
->get('tac_lite_schemes');
for ($i = 1; $i <= $schemes; $i++) {
$config = SchemeForm::tacLiteConfig($i);
if (in_array('grant_' . $op, $config['perms'])) {
$grants[$config['realm']] = _tac_lite_user_tids($account, $i, $config);
}
}
if (count($grants)) {
return $grants;
}
}