Skip to content

notify resource owner when admin shares or unshares - #118

Open
fabracht wants to merge 1 commit into
mainfrom
share-notify-owner
Open

notify resource owner when admin shares or unshares#118
fabracht wants to merge 1 commit into
mainfrom
share-notify-owner

Conversation

@fabracht

@fabracht fabracht commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #110.

  • A resource owner is now notified when someone else (e.g. an admin acting on their behalf) shares or unshares their resource under scoped events; the owner is skipped when they performed the action themselves.
  • Previously only the share path resolved the owner. The unshare path deleted _shares records with an empty ownership config, and the delete path precomputes event recipients from that config, so record_owner returned None and the owner was silently omitted on every unshare (single and cascade).
  • Fix threads the real ownership config through the revoke path (share_revoke → clear_grant → delete_grants, plus write_grant/clear_all_resource_grants), so the owner is resolved while the resource record is still live.
  • The resource-deletion cascade still resolves the owner to None (the resource is already gone by then), which is out of scope here; the grantee is still notified in that path.

Test plan

  • new end-to-end test_unshare_by_admin_notifies_owner drives real Share/Unshare requests as an admin and asserts the emitted _shares delete event reaches both owner and grantee; verified it fails without the fix (owner missing) and passes with it
  • existing share-event and cascade-delete recipient tests pass
  • full mqdb-agent test suite green
  • cargo make clippy clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scoped events: notify resource owner when an admin shares/unshares their resource

1 participant