fix(service): let users get/download/delete their own exports - #482
Open
newmanw wants to merge 1 commit into
Open
fix(service): let users get/download/delete their own exports#482newmanw wants to merge 1 commit into
newmanw wants to merge 1 commit into
Conversation
ensureGetMyExportPermission, ensureGetExportContentPermission, and ensureDeleteMyExportPermission required READ_EXPORT/DELETE_EXPORT role permissions, which the add-export-permissions migration only ever grants to ADMIN_ROLE. Export creation is gated on event access rather than a role permission, so non-admin users could create exports but then could never list, download, or delete their own — despite ownership already being enforced independently at the repository layer (getExportForUser/deleteExportForUser/ getExportsForUser all scope by the requesting user's id). Simplify these checks to just require an authenticated principal, and rename ensureGetExportContentPermission to ensureGetMyExportContentPermission for consistency with the other "my export" checks. Add test coverage for the permission service, which previously had none.
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
ensureGetMyExportPermission,ensureGetExportContentPermission, andensureDeleteMyExportPermissionrequired theREAD_EXPORT/DELETE_EXPORTrole permissions, which theadd-export-permissionsmigration only ever grants toADMIN_ROLE.getExportForUser/deleteExportForUser/getExportsForUserall scope by the requesting user's id).ensureGetExportContentPermission→ensureGetMyExportContentPermissionfor consistency with the other "my export" checks.RoleBasedExportsPermissionService, which previously had none.Test plan
npm run test:build && npx mocha --config .mocharc.js --grep "export"— 31 passing, 1 pre-existing pending (unrelated)