Problem/Motivation

Export of permissions seems to be disabled, as outlined here:
https://www.drupal.org/node/2726409

But import is not disabled. That is, if I add a role to the feature, any permission of that role is seen as a change to that feature but never included in the feature. If I revert that feature, all permissions are always gone.
Looking at the generated yaml this makes sense, because "user.role.[rolemane].yml" always contains an empty "permissions" array, which is imported on revert.

Proposed resolution

Remove the "permissions" array entirely from the exported config until underlying issues are fixed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

keesje created an issue. See original summary.

keesje’s picture

Issue summary: View changes
keesje’s picture

nedjo’s picture

Status: Active » Needs work

Yes, our current approach is wrong and the patch correctly addresses the problem. On config revert, we call ConfigReverter::revert(), which in turn calls ConfigEntityStorage::updateFromStorageRecord(), in which original values are overwritten only if they're set in the new $value array.

Because this is so nonintuitive, we need at least a code comment here to explain why we're unsetting the value. Ideally, we would have a test.

keesje’s picture

FileSize
684 bytes

Like so?

  • mpotter committed 9289710 on 8.x-3.x authored by keesje
    Issue #2757611 by keesje: Permission export disabled, but import is not
    
mpotter’s picture

Status: Needs work » Fixed

Should have been switched back to "Needs review", but patch makes sense. Thanks. Committed to 9289710.

keesje’s picture

Great!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.