1 user_role_layout_access.inc UserRoleLayoutAccess::checkAccess()

Checks for access based on the available context.

Return value

boolean: The result of the access check.

Overrides LayoutAccess::checkAccess

File

core/modules/layout/plugins/access/user_role_layout_access.inc, line 37
Plugin to provide access control based upon role membership.

Class

UserRoleLayoutAccess
@file Plugin to provide access control based upon role membership.

Code

function checkAccess() {
  $account = $this->contexts['user']->data;
  $roles = $account->roles;
  $role_matches = count(array_intersect($this->settings['roles'], $roles)) > 0;
  if ($this->settings['negate']) {
    return !$role_matches;
  }
  else {
    return $role_matches;
  }
}