You are here

function og_get_permissions in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.module \og_get_permissions()

Get all permissions defined by implementing modules.

Return value

Array keyed with the permissions name and the value of the permissions. TODO: Write the values.

10 calls to og_get_permissions()
og_context_plugin_access_og_perm::options_form in og_context/includes/views/handlers/og_context_plugin_access_og_perm.inc
Provide the default form for setting options.
og_get_default_permissions in ./og.module
Get default permissions.
og_handler_field_group_permissions::pre_render in includes/views/handlers/og_handler_field_group_permissions.inc
Run before any fields are rendered.
og_perm_ctools_access_settings in plugins/access/og_perm.inc
Settings form for the 'by perm' access plugin
og_perm_ctools_access_summary in plugins/access/og_perm.inc
Provide a summary description based upon the checked permissions.

... See full list

1 string reference to 'og_get_permissions'
og_invalidate_cache in ./og.module
Invalidate cache.

File

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

Code

function og_get_permissions() {
  $perms =& drupal_static(__FUNCTION__, array());
  if (!empty($perms)) {
    return $perms;
  }
  foreach (module_implements('og_permission') as $module) {
    if ($permissions = module_invoke($module, 'og_permission')) {
      foreach ($permissions as $key => $perm) {
        $permissions[$key] += array(
          // Initialize the roles key, if other modules haven't set it
          // explicetly. This means the permissions can apply to anonymous and
          // authenticated members as-well.
          'roles' => array(
            OG_ANONYMOUS_ROLE,
            OG_AUTHENTICATED_ROLE,
          ),
          'default role' => array(),
          'module' => $module,
        );
      }
      $perms = array_merge($perms, $permissions);
    }
  }

  // Allow other modules to alter the permissions.
  drupal_alter('og_permission', $perms);
  return $perms;
}