You are here

function authcache_role_restrict_members_access in Authenticated User Page Caching (Authcache) 7.2

Check whether given account is allowed by configuration (members only).

Related topics

2 calls to authcache_role_restrict_members_access()
AuthcacheTestAdminWidgets::testRoleRestrictMembersAccess in tests/authcache.widget.test
Cover authcache_role_restrict_members_access().
_authcache_form_allow_notoken in modules/authcache_form/authcache_form.module
Test whether stripping of CSRF token is allowed for the given form.

File

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

Code

function authcache_role_restrict_members_access($config, $account = NULL) {
  global $user;
  if (!$account) {
    $account = $user;
  }
  $allowed_roles = authcache_get_role_restrict_roles($config);
  unset($allowed_roles[DRUPAL_ANONYMOUS_RID]);
  $extra_roles = authcache_diff_roles($account->roles, $allowed_roles);
  return empty($extra_roles);
}