You are here

function og_get_permissions in Organic groups 7

Same name and namespace in other branches
  1. 7.2 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.

9 calls to og_get_permissions()
og_context_plugin_access_og_perm::options_form in og_context/includes/views/og_context_plugin_access_og_perm.inc
Provide the default form for setting options.
og_handler_field_group_permissions::pre_render in includes/views/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 roles.
og_role_grant_permissions in ./og.module
Grant permissions to a user role.

... See full list

2 string references to 'og_get_permissions'
og_invalidate_cache in ./og.module
Invalidate cache.
og_modules_enabled in ./og.module
Implements hook_modules_enabled().

File

./og.module, line 2887
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;
}