Skip to content
Snippets Groups Projects
Commit 53634233 authored by catch's avatar catch
Browse files

Issue #3196245 by prudloff, longwave, smustgrave, berdir, catch:...

Issue #3196245 by prudloff, longwave, smustgrave, berdir, catch: UserPermissionsForm should not use overridden permissions

(cherry picked from commit 02513abe)
parent 49e96345
No related branches found
No related tags found
7 merge requests!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete,!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...
Pipeline #445024 passed
Pipeline: drupal

#445025

    ......@@ -86,7 +86,7 @@ public function getFormId() {
    * An array of role objects.
    */
    protected function getRoles() {
    return $this->roleStorage->loadMultiple();
    return $this->roleStorage->loadMultipleOverrideFree();
    }
    /**
    ......
    <?php
    declare(strict_types=1);
    namespace Drupal\user_config_override_test;
    use Drupal\Core\Config\StorableConfigBase;
    use Drupal\Core\Cache\CacheableMetadata;
    use Drupal\Core\Config\ConfigFactoryOverrideInterface;
    use Drupal\Core\Config\StorageInterface;
    /**
    * Tests overridden permissions.
    */
    class ConfigOverrider implements ConfigFactoryOverrideInterface {
    /**
    * {@inheritdoc}
    */
    public function loadOverrides($names): array {
    return [
    'user.role.anonymous' => [
    'permissions' => [9999 => 'access content'],
    ],
    ];
    }
    /**
    * {@inheritdoc}
    */
    public function getCacheSuffix(): string {
    return 'user_config_override_test';
    }
    /**
    * {@inheritdoc}
    */
    public function getCacheableMetadata($name): CacheableMetadata {
    return new CacheableMetadata();
    }
    /**
    * {@inheritdoc}
    */
    public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION): StorableConfigBase|null {
    return NULL;
    }
    }
    name: 'Permission config overrider'
    type: module
    package: Testing
    version: VERSION
    services:
    user_config_override_test.overrider:
    class: Drupal\user_config_override_test\ConfigOverrider
    tags:
    - { name: config.factory.override }
    ......@@ -37,6 +37,13 @@ class UserPermissionsTest extends BrowserTestBase {
    */
    protected $defaultTheme = 'stark';
    /**
    * {@inheritdoc}
    */
    protected static $modules = [
    'user_config_override_test',
    ];
    /**
    * {@inheritdoc}
    */
    ......@@ -333,4 +340,16 @@ public function testBundlePermissionError(): void {
    $assert_session->pageTextNotContains("Entity view display 'node.article.default': Component");
    }
    /**
    * Verify that the permission form does not use overridden config.
    *
    * @see \Drupal\user_config_override_test\ConfigOverrider
    */
    public function testOverriddenPermission(): void {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/people/permissions');
    $this->assertSession()->checkboxNotChecked('anonymous[access content]');
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment