function _rac_get_account_roles in Role Access Control 8
Same name and namespace in other branches
- 8.2 rac.module \_rac_get_account_roles()
Determine the access for a given accont and operation.
4 calls to _rac_get_account_roles()
- rac_fca_field_collection_item_grants in contrib/
rac_fca/ rac_fca.module - Implements hook_field_collection_item_grants().
- rac_na_node_grants in contrib/
rac_na/ rac_na.module - Implements hook_node_grants().
- rac_pa_paragraphs_access_grants in contrib/
rac_pa/ rac_pa.module - Implements hook_paragraphs_access_grants().
- _rac_restrict_field_values in ./
rac.module - Remove options from a field that should not be displayed to the user.
File
- ./
rac.module, line 16 - Module providing role access relations.
Code
function _rac_get_account_roles($op, $account) {
$userRoles = [];
$roles = user_roles();
foreach ($roles as $role) {
$permission = "RAC_" . $op . "_" . $role
->id();
if ($account
->hasPermission($permission)) {
$userRoles[] = $role;
}
}
return $userRoles;
}