feat(cli): add --no-sync-policy-roles flag#203
Merged
Conversation
Allows leaving role ↔ policy attachments (directus_access entries) untouched on the target instance, so end-user-managed assignments are not overwritten by sync. Closes #199 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22f6a75 to
130c2a9
Compare
|
Nice @EdouardDem ! When do you plan to release a new version with this included? |
Member
Author
|
@BorisKamp I'll do it in the next hour, after merging #204 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--no-sync-policy-roles(and matchingsyncPolicyRolesconfig option) so role ↔ policy attachments (directus_accessentries linking roles and policies) can be left untouched on the target during sync.PoliciesDataClient.getQueryCommandomits theroles.*fields, so attachments are never dumped or fetched from the target.PoliciesDataClient.getUpdateCommandstripsdiffItem.rolesbefore updating, so existing target attachments are preserved.Fixes #199 — addresses the case where end-users (clients) attach policies to roles in production and those assignments were being wiped on every push.
Note on user-policy attachments:
directus_accessentries that link policies to users (rather than roles) are already not dumped nor modified by the current sync logic, so they remain untouched without any additional flag.Test plan
tsc --noEmitclean forpackages/cliandpackages/e2enpm run buildsucceeds inpackages/clipushWithNoSyncPolicyRolescovers:--no-sync-policy-rolesis setpull --no-sync-policy-rolesdoes not includerolesin the dumped policy file🤖 Generated with Claude Code