Overridden config right after site install

Created on 7 September 2022, over 2 years ago
Updated 15 January 2024, 11 months ago

Problem/Motivation

When a site is installed from configuration (eg. via drush si --existing-config), it may end up with overridden config, because \Drupal\administerusersbyrole\Services\AccessManager::rolesChanged() is also changing the config during config import.

Steps to reproduce

Set up a site with this module and several roles configured.
Export the config (eg. via drush cex).
Reinstall the site from configuration (eg. via drush si --existing-config).

Expected result: no overridden configuration (drush cim shows no changes).

Actual result: administerusersbyrole.settings might have changed compared to the exported config (drush cim does have changes to import).

Proposed resolution

\Drupal\administerusersbyrole\Services\AccessManager::rolesChanged() should not change the config during config import (sync).

Remaining tasks

Review, commit, release.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary boobaa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany luenemann SΓΌdbaden, Germany
    1. But a config import would delete any new Roles, not present in the export.
    2. Agree needs to be addressed.
  • πŸ‡¬πŸ‡§United Kingdom adamps

    But a config import would delete any new Roles, not present in the export.

    Thanks for continuing the discussion. I still have some questions:

    1) How can we be sure that this is true? ConfigInstallerInterface::setSyncing() can be called by any code. It is set when installing a module in ModuleInstaller::install(), which would presumably not delete any roles.

    2) If the config import does delete roles no present in the export, how come config is overridden? It seems to me like this:

    • If a role is missing from administerusersbyrole.settings, this module will cause a config override, and this is correct.
    • If no role is missing, this module will not cause a config override.

    So I don't understand when there is a problem.

  • πŸ‡©πŸ‡ͺGermany luenemann SΓΌdbaden, Germany

    Hm - i just came to evaluate this module and left a comment.
    So next step is to reproduce the Issue on my side.

    I just had an idee to avoid administerusersbyrole.settings at all. Attach the configuration to each role config via third_party_settings.

  • πŸ‡­πŸ‡ΊHungary Agnes_Varro

    Patch changed according to the changes introduced in version 3.4.

  • πŸ‡­πŸ‡ΊHungary Agnes_Varro

    Patch changed according to the changes introduced in version 3.4.

  • πŸ‡­πŸ‡ΊHungary mxr576 Hungary

    Hiding outdated patch.

  • First commit to issue fork.
  • πŸ‡¬πŸ‡§United Kingdom lind101

    Same issue runing v3.4 on Drupal 10.1.2. Patch in #9 fixes the issue. Thanks!

Production build 0.71.5 2024