Skip to content
Snippets Groups Projects
Commit 02513abe 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
parent b1a764c1
No related branches found
No related tags found
1 merge request!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes
Pipeline #444973 passed with warnings
Pipeline: drupal

#444996

    Pipeline: drupal

    #444988

      Pipeline: drupal

      #444977

        ...@@ -86,7 +86,7 @@ public function getFormId() { ...@@ -86,7 +86,7 @@ public function getFormId() {
        * An array of role objects. * An array of role objects.
        */ */
        protected function getRoles() { 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 { ...@@ -37,6 +37,13 @@ class UserPermissionsTest extends BrowserTestBase {
        */ */
        protected $defaultTheme = 'stark'; protected $defaultTheme = 'stark';
        /**
        * {@inheritdoc}
        */
        protected static $modules = [
        'user_config_override_test',
        ];
        /** /**
        * {@inheritdoc} * {@inheritdoc}
        */ */
        ...@@ -333,4 +340,16 @@ public function testBundlePermissionError(): void { ...@@ -333,4 +340,16 @@ public function testBundlePermissionError(): void {
        $assert_session->pageTextNotContains("Entity view display 'node.article.default': Component"); $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.
        Finish editing this message first!
        Please register or to comment