You are here

function authcache_diff_roles in Authenticated User Page Caching (Authcache) 7.2

Diff user roles.

Returns an array containing all the roles from account_roles that are not present in allowed_roles.

Related topics

3 calls to authcache_diff_roles()
authcache_authcache_account_exclude in ./authcache.module
Implements hook_authcache_account_exclude().
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 777
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_diff_roles($account_roles, $allowed_roles) {

  // Remove "authenticated user"-role from the account roles except when it is
  // the only role on the account.
  if (array_keys($account_roles) !== array(
    DRUPAL_AUTHENTICATED_RID,
  )) {
    unset($account_roles[DRUPAL_AUTHENTICATED_RID]);
  }
  return array_diff_key($account_roles, $allowed_roles);
}