function oa_core_section_access in Open Atrium Core 7.2
Determine access to a Open Atrium Section do NOT use node_load here as it gets called from hook_node_grants() TODO: No longer called from node_grants, but called from tests. Is this still needed?
1 call to oa_core_section_access()
File
- includes/
oa_core.access.inc, line 12 - Code for Access Control functions for OpenAtrium spaces
Code
function oa_core_section_access($row, $spaces, $account) {
$gid = $row['field_oa_group_ref_target_id'];
$team_id = $row['field_oa_team_ref_target_id'];
$user_id = $row['field_oa_user_ref_target_id'];
// check if no access fields are set
if (is_null($gid) && is_null($team_id) && is_null($user_id)) {
return NODE_ACCESS_ALLOW;
}
// Test Group membership
if (!is_null($gid) && !empty($spaces['node'])) {
if (in_array($gid, $spaces['node'])) {
return NODE_ACCESS_ALLOW;
}
}
// Test Team membership
if (!is_null($team_id)) {
if (oa_core_member_of_team($team_id, $account->uid)) {
return NODE_ACCESS_ALLOW;
}
}
// Test User membership
if (!is_null($user_id)) {
if ($user_id == $account->uid) {
return NODE_ACCESS_ALLOW;
}
}
// none of the groups, teams, or users allowed access, so deny access
return NODE_ACCESS_DENY;
}