You are here

function _authcache_get_roles in Authenticated User Page Caching (Authcache) 6

Same name and namespace in other branches
  1. 7 authcache.admin.inc \_authcache_get_roles()

Helper function, get authcache user roles

Parameters

$all_roles = return all user roles:

Return value

array of user roles

2 calls to _authcache_get_roles()
authcache_admin_config in ./authcache.admin.inc
Main Authcache configuration form
_authcache_pagecache_form in ./authcache.admin.inc
Add new page caching rule to form (part of AHAH)

File

./authcache.admin.inc, line 489
Admin forms and pages.

Code

function _authcache_get_roles($all_roles = FALSE) {
  $roles = user_roles();
  $roles[DRUPAL_AUTHENTICATED_RID] .= t(' (without additional roles)');
  if ($all_roles) {
    return $roles;
  }
  else {
    $authcache_roles = array();
    foreach (variable_get('authcache_roles', array()) as $key) {
      $authcache_roles[$key] = $roles[$key];
    }
    return $authcache_roles;
  }
}