You are here

function _oa_access_is_overridden in Open Atrium Core 7.2

Helper function to determine if a permission is overridden by Group or Team.

Parameters

string $perm: The permission name.

integer $space_nid : The nid of a Space, when checking if Teams override, or zero if checking if the Groups override.

1 call to _oa_access_is_overridden()
oa_access in modules/oa_access/oa_access.module
Determines if the user has a permission.

File

modules/oa_access/oa_access.module, line 554
Code for the Open Atrium Access module.

Code

function _oa_access_is_overridden($perm, $space_nid) {
  $groups =& drupal_static(__FUNCTION__, array());
  if (!isset($groups[$space_nid])) {
    if ($space_nid == 0) {

      // Get an array of all the Group nids.
      $groups[$space_nid] = array_keys(oa_core_get_all_groups());
    }
    else {

      // Get an array of all the Team nids.
      $groups[$space_nid] = array_keys(oa_teams_get_teams_for_space($space_nid));
    }

    // Add the magic 'All' option.
    $groups[$space_nid][] = $space_nid;
  }
  $permissions = oa_access_get_group_permissions_combined($groups[$space_nid]);
  return isset($permissions[$perm]);
}