Skip to content

server: grant recipients access to shares - #99

Merged
littlegrasscao merged 4 commits into
mainfrom
server/split2/10-share-grants
Oct 21, 2026
Merged

littlegrasscao merged 4 commits into
mainfrom
server/split2/10-share-grants

Conversation

@littlegrasscao

@littlegrasscao littlegrasscao commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add SharePermissionEntity persistence for the privileges recipients hold on shares; SELECT is the only privilege so far
  • GET /shares/{share}/permissions lists who holds which privilege on the share, by recipient name; any caller may list
  • PATCH /shares/{share}/permissions grants and revokes privileges on one share for one or more recipients, then returns the share's permissions. Owner only
    • the body is {"changes": [{"recipientName": "<recipient name>", "add": ["SELECT"], "remove": ["SELECT"]}]}; each change revokes before it grants, and changes apply in request order
    • an update is atomic, as in Databricks UpdatePermissions: every grant and revoke runs in one database transaction, and any failure, such as revoking a privilege the recipient does not hold, rolls back the whole request
    • recipients are looked up before the transaction opens, so an unknown recipient also leaves the permissions unchanged
    • granting a privilege the recipient already holds is a no-op; revoking one it does not hold is 404
    • the share's row lock from server: add provider-admin share entities and CRUD #96 makes concurrent updates of one share's permissions run one at a time, so this holds even when two requests grant or revoke the same privilege together
  • deleting a share or a recipient deletes its permissions

Testing

  • mvn clean install: 106 tests passed
  • SharePermissionAdminServiceTest: owner-only grants, case-insensitive recipient names, idempotent grants, listing by any caller, revokes, 404 for revoking an ungranted privilege, and 400 for null changes or privileges
  • SharePermissionUpdateTransactionTest:
    • revoking from one recipient and granting to another, then revoking from a recipient that holds nothing, returns 404; the first recipient still holds SELECT and the second was not granted it
    • the same request ending with an unknown recipient returns 404 and changes nothing
  • SharePermissionConcurrencyTest: two concurrent grants of the same privilege both succeed, and two concurrent revokes return 200 and 404

@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from da33e4e to d1e56b7 Compare September 18, 2026 20:15
@littlegrasscao
littlegrasscao marked this pull request as ready for review September 18, 2026 21:21
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from d1e56b7 to c10cb84 Compare September 22, 2026 16:42
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from c10cb84 to fc63b77 Compare September 25, 2026 22:19
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from fc63b77 to 22cd8c1 Compare September 25, 2026 22:27
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 22cd8c1 to 333b4b5 Compare September 25, 2026 22:32
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 333b4b5 to 47a5f26 Compare September 25, 2026 22:37
@littlegrasscao
littlegrasscao requested a review from zhu-tom October 1, 2026 00:17
@zhu-tom
zhu-tom added this pull request to stack #111 October 1, 2026 18:55
@littlegrasscao
littlegrasscao removed this pull request from stack #111 October 1, 2026 20:19
@littlegrasscao
littlegrasscao added this pull request to stack #112 October 1, 2026 20:20
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 47a5f26 to 3cd9812 Compare October 2, 2026 16:16
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 3cd9812 to 43e75e8 Compare October 2, 2026 16:40
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 43e75e8 to 1462b39 Compare October 5, 2026 20:57
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 1462b39 to 0df270f Compare October 5, 2026 21:25
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 0df270f to b83b41e Compare October 5, 2026 23:59
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from b83b41e to 47dcb11 Compare October 6, 2026 00:06
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 030bda8 to 5e17bac Compare October 8, 2026 00:44
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 5e17bac to 19a2795 Compare October 9, 2026 23:35
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 19a2795 to 731183e Compare October 13, 2026 23:38
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 731183e to 7c12b02 Compare October 13, 2026 23:55
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 7c12b02 to 80a1793 Compare October 14, 2026 00:06
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 80a1793 to 1cd5116 Compare October 14, 2026 00:56
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 1cd5116 to 177c961 Compare October 14, 2026 19:24
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch 2 times, most recently from 5b53b3f to a7c5029 Compare October 15, 2026 18:13
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from a7c5029 to 75433af Compare October 15, 2026 23:34
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 75433af to e1779ac Compare October 15, 2026 23:38
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from e1779ac to 496f3e1 Compare October 16, 2026 00:40
@littlegrasscao
littlegrasscao force-pushed the server/split2/10-share-grants branch from 496f3e1 to e0e59b8 Compare October 19, 2026 17:12
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.

2 participants