You are here

protected function OpenAtriumAccessBaseTestCase::getGroupPermissions in Open Atrium Core 7.2

Gets all the permissions that a list of groups have.

Wraps oa_access_get_group_permissions(). Since we're using SimpleTestCloneTestCase, we can't guarantee that only our permissions are available, so we have to filter out all others.

Parameters

string $module: The name of the module whose permissions we want included.

array $groups: An array of nids of Groups or Teams.

Return value

array An associative array keyed by group nid containing associative arrays keyed by the module and containing an array of permission names, for example:

array(
  '27' => array(
    'mymodule' => array(
      'a permission',
    ),
  ),
);

Which signifies that the group with nid 27 has 'a permission' from a module called 'mymodule'.

See also

oa_access_get_group_permissions().

1 call to OpenAtriumAccessBaseTestCase::getGroupPermissions()
OpenAtriumAccessAllTestCase::testModuleEnableAndInitialize in modules/oa_access/tests/oa_access.test

File

modules/oa_access/tests/oa_access.test, line 290
Functional tests for the Open Atrium Access module.

Class

OpenAtriumAccessBaseTestCase

Code

protected function getGroupPermissions($module, $groups) {
  $permissions = array();
  foreach (oa_access_get_group_permissions($groups) as $gid => $info) {
    if (empty($permissions[$gid])) {
      $permissions[$gid] = array();
    }
    if (isset($info[$module])) {
      $permissions[$gid][$module] = $info[$module];
    }
  }
  return $permissions;
}