Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | empty_permission_export-2757611-5.patch | 684 bytes | keesje |
Comments
Comment #2
keesje CreditAttribution: keesje commentedComment #3
keesje CreditAttribution: keesje commentedComment #4
nedjoYes, our current approach is wrong and the patch correctly addresses the problem. On config revert, we call
ConfigReverter::revert()
, which in turn callsConfigEntityStorage::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.
Comment #5
keesje CreditAttribution: keesje commentedLike so?
Comment #7
mpotter CreditAttribution: mpotter at Phase2 commentedShould have been switched back to "Needs review", but patch makes sense. Thanks. Committed to 9289710.
Comment #8
keesje CreditAttribution: keesje commentedGreat!