You are here

function og_get_default_permissions in Organic groups 7.2

Get default permissions.

Return value

Array keyed with the anonymous, authenticated and administror and the permissions that should be enabled by default.

2 calls to og_get_default_permissions()
OgMigrateRoles::preImport in includes/migrate/7200/og_roles.migrate.inc
Copy all existing global roles to bundle-specific versions. Although similar processing is available through the og_roles_override() function, special handling is necessary to ensure that custom global roles are copied as well as default global roles.
og_roles_override in ./og.module
Create new roles, based on the default roles and permissions.

File

./og.module, line 3279
Enable users to create and manage groups with roles and permissions.

Code

function og_get_default_permissions() {
  $roles = og_get_default_roles();
  $default_perms = og_get_permissions();
  $perms = array();
  foreach ($roles as $rid => $role_name) {
    $perms[$rid] = array();

    // For each default role, iterate default permissions and mark the
    // permissions that set the role as default.
    foreach ($default_perms as $perm_name => $perm) {
      if (in_array($role_name, $perm['default role'])) {
        $perms[$rid][$perm_name] = TRUE;
      }
    }
  }
  return $perms;
}