1 user_compare_layout_access.inc UserCompareLayoutAccess::checkAccess()

Checks for access based on the available context.

Return value

boolean: The result of the access check.

Overrides LayoutAccess::checkAccess


core/modules/layout/plugins/access/user_compare_layout_access.inc, line 56
Contains UserCompareLayoutAccess class.


Plugin to provide access if two user account contexts are the same.


function checkAccess() {
  if (empty($this->contexts) || count($this->contexts) != 2 || empty($this->contexts['user1']->data) || empty($this->contexts['user2']->data)) {
    return FALSE;

  $account1 = $this->contexts['user1']->data;
  $account2 = $this->contexts['user2']->data;

  // The xor returns false if the two booleans are the same, and true if they
  // are not. For example: if we asked for equality and they are equal, return
  // true. If we asked for inequality and they are equal, return false.
  return ($account1->uid == $account2->uid) xor empty($this->settings['equality']);