Commit ab1c7825 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Andrey Postnikov
Browse files

Issue #3288461 by Berdir, Project Update Bot: Automated Drupal 10 compatibility fixes

parent c130db70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
  },
  "license": "GPL-2.0-or-later",
  "require": {
    "drupal/core": "^8.8 || ^9"
    "drupal/core": "^8.8 || ^9 || ^10"
  },
  "minimum-stability": "dev"
}
+1 −1
Original line number Diff line number Diff line
name: Masquerade
type: module
description: 'Allows privileged users to masquerade as another user.'
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^8.8 || ^9 || ^10
dependencies:
  - drupal:user
tags:
+7 −15
Original line number Diff line number Diff line
@@ -94,25 +94,17 @@ function masquerade_target_user_access(UserInterface $target_account) {
  }

  // Invoke hook_masquerade_access() implementations.
  $access = NULL;
  foreach (\Drupal::moduleHandler()->getImplementations('masquerade_access') as $module) {
    $function = $module . '_masquerade_access';
    $result = $function($user, $target_account);
  $results = \Drupal::moduleHandler()->invokeAll('masquerade_access', [$user, $target_account]);

  // If an implementation explicitly denies access, then there is nothing else
  // to check.
    if ($result === FALSE) {
      $access = FALSE;
      break;
    }
    elseif ($result === TRUE) {
      $access = TRUE;
    }
  }
  // If no module granted access, then access is denied.
  if (!isset($access) || !$access) {
  if (in_array(FALSE, $results, TRUE)) {
    return FALSE;
  }
  return TRUE;

  // If access is not explicitly denied, allow access if at least one hook
  // implementation allowed access.
  return in_array(TRUE, $results, TRUE);
}

/**
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ class MasqueradePermissions {
      $permissions['masquerade as ' . $role->id()] = [
        'title' => $this->t('Masquerade as @role', ['@role' => $role->label()]),
        'restrict access' => TRUE,
        'dependencies' => [
          $role->getConfigDependencyKey() => [$role->getConfigDependencyName()]
        ]
      ];
    }

+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ abstract class MasqueradeWebTestBase extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();

    // Create and configure User module's admin role.
Loading