Skip to content

Commit 4bfe46d

Browse files
committed
docs(plugin-sharing): name the storage cause of SHARING_NOT_ENABLED; changeset names @objectstack/spec (#33787)
L1-a 7065619919 R1/R2 and contract record 7065677186 nit C: the two pages that list SHARING_NOT_ENABLED causes now name the ADR-0155 R2 cause (another datasource than sys_record_share, or a driver that does not evaluate the share-grant subquery) and the remedy; the changeset adds the @objectstack/spec patch line for the published contract TSDoc. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5krBqrrgxCYgjXmfbv
1 parent 4f11b21 commit 4bfe46d

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎.changeset/33787-shared-record-ids-switch.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
'@objectstack/plugin-sharing': patch
33
'@objectstack/plugin-security': patch
4+
'@objectstack/spec': patch
45
---
56

67
fix(plugin-sharing)!: every share grant counts; the sharing scopes carry the share-grant leaf instead of a list capped at 5,000 grants (ADR-0155 plan step 6)

‎content/docs/kernel/runtime-services/sharing-service.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ mask AND-ed with object CRUD, not a fourth `access_level`.
6464
- `PERMISSION_DENIED` (403) — the caller does not hold `canManageShares` on the record (ADR-0111 D1). On the sharing-**rule** surface (`ISharingRuleService`, declared in the same canonical source — `listRules` / `getRule` / `defineRule` / `deleteRule` / `evaluateRule`) the same code carries a second condition: the caller holds `manage_sharing` but their session resolves **no active organization**, and an org-scoped capability with no organization has no tenant whose rules it authorizes. System contexts and platform operators (`manage_platform_settings`, or the `platform_admin` position) are unaffected — see [Rule administration](/docs/permissions/sharing-rules).
6565
- `NOT_FOUND` (404) — the record is missing **or not visible to the caller** (indistinguishable by design), or a `revoke` share id does not exist / does not belong to the `scope` record.
6666
- `CONFLICT` (409) — `revoke` on a rule-materialised share (`source != 'manual'`); the next rule reconciliation would silently re-grant it. Deactivate or edit the sharing rule instead.
67-
- `SHARING_NOT_ENABLED` (422) — `grant` on an object the sharing gates never consult for the recipient (a public sharing model, unless the recipient is an `external` member of the record's organization, whose owner-only floor does consult it; no `owner_id` field; a bypass object, `controlled_by_parent`, or a **federated** object whose `owner_id` is the platform's injected anchor rather than a real remote column — the platform provisions no storage for a federated object, so the gates read that column off a table that has not got it and can never admit). On the sharing-**rule** surface, `defineRule` (and a `sys_sharing_rule` write through the `/data` door) answers the same code when the rule's object is one no gate consults for any recipient: the rule is refused at save instead of saved to share nothing.
67+
- `SHARING_NOT_ENABLED` (422) — `grant` on an object the sharing gates never consult for the recipient (a public sharing model, unless the recipient is an `external` member of the record's organization, whose owner-only floor does consult it; no `owner_id` field; a bypass object, `controlled_by_parent`, or a **federated** object whose `owner_id` is the platform's injected anchor rather than a real remote column — the platform provisions no storage for a federated object, so the gates read that column off a table that has not got it and can never admit; or an object whose share grants cannot count where it is stored — it sits on another datasource than `sys_record_share`, even a SQL one, or on a driver that does not evaluate the share-grant subquery, today MongoDB, in-memory and OData (ADR-0155 R2); to share its records, store it on the datasource of `sys_record_share`, on a driver that evaluates share grants, as the SQL drivers do). On the sharing-**rule** surface, `defineRule` (and a `sys_sharing_rule` write through the `/data` door) answers the same code when the rule's object is one no gate consults for any recipient: the rule is refused at save instead of saved to share nothing.
6868

6969
## Enforcement is automatic — do not re-check it in a hook
7070

‎content/docs/permissions/sharing-rules.mdx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ organization, every other recipient is refused with `SHARING_NOT_ENABLED`
161161
A sharing rule on an object that no sharing gate consults for any recipient is
162162
refused when it is saved: an object with no real `owner_id` (a system object
163163
without one, such as `sys_session`, or a federated object whose `owner_id` is
164-
the platform's injected anchor), a `controlled_by_parent` detail, or a bypass
165-
object. It is refused with `SHARING_NOT_ENABLED` (422) and a sentence that
164+
the platform's injected anchor), a `controlled_by_parent` detail, a bypass
165+
object, or an object whose share grants cannot count where it is stored (it
166+
sits on another datasource than `sys_record_share`, even a SQL one, or on a
167+
driver that does not evaluate the share-grant subquery: today MongoDB,
168+
in-memory and OData; ADR-0155 R2). It is refused with `SHARING_NOT_ENABLED` (422) and a sentence that
166169
names the object and how to turn record sharing on for it. This holds for Setup's form and the
167170
`/data` door as well as `POST /api/v1/sharing/rules`, and for an edit that moves
168171
a rule onto such an object. A rule saved before this check keeps its row and

0 commit comments

Comments
 (0)