You are here

function authcache_get_role_restrict_roles in Authenticated User Page Caching (Authcache) 7.2

Return a list of allowed roles.

Depending on the passed in configuration, either the authcache default roles will be returned or the configured roles intersected with the default roles.

Parameters

array $config: A role restrict configuration from an authcache_role_restrict widget.

Return value

array A list of allowed roles (rid => role name)

Related topics

5 calls to authcache_get_role_restrict_roles()
AuthcacheTestAdminWidgets::testGetRoleRestrict in tests/authcache.widget.test
Cover authcache_get_role_restrict_roles().
authcache_admin_pagecaching_submit in ./authcache.admin.inc
Page caching rules form submit.
authcache_process_role_restrict in ./authcache.module
Form API process callback for authcache_role_restrict element.
authcache_role_restrict_access in ./authcache.module
Check whether given account is allowed by configuration.
authcache_role_restrict_members_access in ./authcache.module
Check whether given account is allowed by configuration (members only).

File

./authcache.module, line 1292
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_get_role_restrict_roles($config) {
  $authcache_roles = authcache_get_roles();
  if (empty($config['custom'])) {
    $result = $authcache_roles;
  }
  elseif (empty($config['roles'])) {
    $result = array();
  }
  else {
    $result = array_intersect_key($authcache_roles, $config['roles']);
  }
  return $result;
}