Skip to content

fix(service): let users get/download/delete their own exports - #482

Open
newmanw wants to merge 1 commit into
ngageoint:developfrom
newmanw:fix/export-permissions-check-user-not-role
Open

fix(service): let users get/download/delete their own exports#482
newmanw wants to merge 1 commit into
ngageoint:developfrom
newmanw:fix/export-permissions-check-user-not-role

Conversation

@newmanw

@newmanw newmanw commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • ensureGetMyExportPermission, ensureGetExportContentPermission, and ensureDeleteMyExportPermission required the 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 three checks to just require an authenticated principal, and rename ensureGetExportContentPermissionensureGetMyExportContentPermission for consistency with the other "my export" checks.
  • Add test coverage for 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)
  • Manually verify a non-admin user can list, download, and delete their own exports

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant