You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(sharing): registered subject providers; built-in user and tenant_role recipients (#963) - #1039
Sharing recipients are no longer users only. Modules register subject providers through sharing.contracts. Each provider validates a subject id for the sharer (active tenant, same enumeration protections as users), supplies masked or batched labels, and supplies a membership predicate that stays inside the single policy SQL query. Closessharing: recipients are users only (no group/team subject types) #963
Built-in providers:
user: today's behaviour, unchanged; a grant request without subject_type still means a user.
tenant_role: shares with everyone who holds a role in the active tenant. A role change takes effect on the next request, and a grant in tenant A never applies in tenant B.
Unknown or unregistered subject types are refused at grant time, and existing rows of such a type grant nothing (fail closed).
API: subject_type on grants, GET /api/sharing/subject-types, and typed /candidates. Role search matches ids and the request-locale label, ignoring case and diacritics, so Eigentumer finds Eigentümer. api.generated.ts is regenerated.
ShareDialog and useShares show a translated type switch when more than one provider is registered.
docs/modules/sharing.md (provider API and example), CHANGELOG. No migration.
Verification
No host page or installed module registers a shareable resource type yet, so the dialog can't be exercised end to end in the running app and there are no screenshots. Coverage comes from the sharing HTTP suite (290 tests with tenants) and the dialog's Vitest tests.
Local CI: make lint ✓, make test-js 976 passed, make test-py 9179 passed. After rebasing onto modules: declare an admin surface and permissions once #988: lint ✓, and the overlapping suites (sharing, tenants, users, api_tokens, permissions, core, hosting, host) passed, 4063 tests.
/ship passed on cbe8c46
Rounds: 1 of 3
Review: 3 passes; pass 1 (security: principal parity with #1005, tenant scoping, revocation, fail-closed, single query) found 1 (role search ignored localized labels), pass 2 found 1 (no diacritic folding), both fixed with en/de tests; pass 3 clean.
QA: no host page or installed module registers a shareable resource type, so no live dialog run; covered by the sharing HTTP suite and the dialog Vitest tests (stated in the PR).
Local CI: make lint ✓, make test-js 976 passed, make test-py 9179 passed; after rebasing on #988: lint ✓ and overlapping suites 4063 passed.
CI: PR checks SUCCESS
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
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
sharing.contracts. Each provider validates a subject id for the sharer (active tenant, same enumeration protections as users), supplies masked or batched labels, and supplies a membership predicate that stays inside the single policy SQL query. Closes sharing: recipients are users only (no group/team subject types) #963user: today's behaviour, unchanged; a grant request withoutsubject_typestill means a user.tenant_role: shares with everyone who holds a role in the active tenant. A role change takes effect on the next request, and a grant in tenant A never applies in tenant B.subject_typeon grants,GET /api/sharing/subject-types, and typed/candidates. Role search matches ids and the request-locale label, ignoring case and diacritics, soEigentumerfindsEigentümer.api.generated.tsis regenerated.ShareDialoganduseSharesshow a translated type switch when more than one provider is registered.principal_for(No way to build a user's principal outside a request (worker, token-authenticated feed) #1005) still produce identical principals, and a warm request adds no queries.docs/modules/sharing.md(provider API and example), CHANGELOG. No migration.Verification
make lint✓,make test-js976 passed,make test-py9179 passed. After rebasing onto modules: declare an admin surface and permissions once #988: lint ✓, and the overlapping suites (sharing, tenants, users, api_tokens, permissions, core, hosting, host) passed, 4063 tests.Test plan
https://claude.ai/code/session_01FXHA3Zj78w6GWaNKoovHq6