fix: [DHIS2-21871] preserve working-list view sharing on update - #4666
Open
gqcorneby wants to merge 1 commit into
Open
fix: [DHIS2-21871] preserve working-list view sharing on update#4666gqcorneby wants to merge 1 commit into
gqcorneby wants to merge 1 commit into
Conversation
Saving a working-list view (event filter, TEI filter, or program-stage working list) sent a full PUT/replace carrying only the legacy sharing fields (publicAccess, externalAccess, userAccesses, userGroupAccesses). From api/41 the metadata update path no longer honours those legacy fields, so the replace resets the object's sharing to defaults. Switch the three update epics to a json-patch that touches only name and query criteria, leaving sharing and ownership untouched. Dropping the owner field also avoids the 409 for non-owner saves (DHIS2-13020). Update the working-list e2e intercepts from PUT to PATCH accordingly.
|
Contributor
|
Hi, @gqcorneby! Thanks for the work on this! We appreciate the effort and will give the PR a closer look soon. Thanks for your patience! |
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.



DHIS2-21871
Summary
Saving a working list view (event filter, TEI filter, or program stage working list) wipes its sharing: user and user group accesses are cleared and public access resets to default.
Root cause
The update epics send a full
PUT(type: 'replace') with only the legacy sharing fields (publicAccess,externalAccess,userAccesses,userGroupAccesses) and nosharingobject. From api/41 those legacy fields are ignored, so a full replace resets sharing to defaults. Regression of DHIS2-8420 (whose fix, DHIS2-10493 / DHIS2-10651, added those legacy fields).Changes
eventFilters,trackedEntityInstanceFilters,programStageWorkingLists) fromtype: 'replace'totype: 'json-patch', patching onlynameand the query criteria. Sharing and ownership stay out of the payload, so the server leaves them untouched. (This is DHIS2's documented partial update path; a plainapplication/jsonPATCH returns 415 here.)toJsonPatchReplaceOps, unit tested.mutatetype incapture-core-utils/types/global.tsto include'json-patch'.user(owner) also fixes the non-owner 409 on save (DHIS2-13020).PUTtoPATCH.Testing
Verified on play 2.41, 2.43, 2.44: sharing preserved after saving a view. JSON Patch is documented back to 2.40.