function og_subgroups_og_user_access_alter in Subgroups for Organic groups 7.2
Same name and namespace in other branches
- 7 og_subgroups.module \og_subgroups_og_user_access_alter()
Implements hook_og_user_access_alter().
Inherit every permission the user had in the parent groups; i.e. we only "add" permissions.
File
- ./
og_subgroups.module, line 263 - Provides users the ability to inherit permissions on subgroups.
Code
function og_subgroups_og_user_access_alter(&$perms, $context) {
if (!empty($perms[$context['string']])) {
// Permission is already TRUE, no need to check.
return;
}
$group_type = $context['group_type'];
$group = $context['group'];
list($id) = entity_extract_ids($group_type, $group);
// Find the parents the current user is part of
$groups = og_subgroup_user_groups_load($context['account'], FALSE);
_og_subgroups_check_access($perms, $context, $group_type, $id, $groups, TRUE);
}