You are here

function oa_subspaces_og_permission_alter in Open Atrium Subspaces 7.2

Implements hook_og_permission_alter().

Changes group create permissions to restricted.

File

./oa_subspaces.module, line 411

Code

function oa_subspaces_og_permission_alter(&$permissions) {
  foreach (node_permissions_get_configured_types() as $type) {
    if (og_is_group_type('node', $type) && ($perms = og_list_permissions($type))) {
      foreach (array_keys($perms) as $perm_name) {

        // Group permission should onyl use the global field.
        if ($type == 'oa_group') {
          unset($permissions[$perm_name]);
        }
        elseif (!empty($permissions[$perm_name])) {
          $permissions[$perm_name]['restrict access'] = TRUE;
          $permissions[$perm_name]['default role'] = array(
            OG_ADMINISTRATOR_ROLE,
          );
          $permissions[$perm_name]['roles'] = array(
            OG_AUTHENTICATED_ROLE,
          );
        }
      }
    }
  }
}