Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/35619-user-actions-export-csv-enforced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'@objectstack/spec': minor
'@object-ui/core': minor
'@object-ui/plugin-grid': minor
'@object-ui/plugin-list': minor
'@object-ui/plugin-report': minor
'@objectstack/platform-objects': patch
---

feat: an object's `userActions.exportCsv: false` hides the console's Export entry

Clause-②: yes
Metadata-protocol: semantic

`userActions.exportCsv` on an object now does what the Studio object form says it does. Set to `false`, the console offers no Export entry for downloading that object's data, in any of its formats (CSV, XLSX, JSON):

- the object grid hides its toolbar Export menu, and the table's own CSV button that `operations.export: true` turns on;
- the list view hides Export in both toolbar forms, the wide toolbar's button and the Display panel's export footer;
- a dataset report hides its Export control when the dataset's base object sets it.

A view's export of the picture it draws is not covered: a Gantt view's PNG and PDF buttons stay.

Every surface reads one verdict, the new `isObjectExportOffered(objectSchema, effectiveApiOperations)` from `@object-ui/core`: the authored `exportCsv` over the object's `managedBy` default, ANDed with the caller's effective `export` API operation. Before this change the grid's toolbar menu, the list view and the report read the effective operation but not the object's bit, and the grid's table CSV button read neither half (only `operations.export`), so `exportCsv: false` changed nothing. Export is a read, so the verdict is not a row of `AFFORDANCE_GRANTS` and asks no `can(object, verb)`: the caller's export grant reaches the console through the effective `export` operation, which the server derives from `list` and `allowExport`.

An object that does not author the key keeps its Export entries, since every `managedBy` bucket still defaults `exportCsv` to `true` (ADR-0103), with one change: the grid's table CSV button (`operations.export: true`) now also follows the effective `export` operation, as the toolbar menu beside it already did. So a viewer whose effective operations exclude `export` no longer sees that button, even on an object that authors nothing. The setting hides the entry and is not a permission: no export request is refused because of it, and who may export is still the permission set's `allowExport`. The report reads the base object's definition through the report's data source, and a report whose source cannot serve one keeps its Export control.

The spec's `exportCsv` description and the Studio form's help text now say this; the form's English help text bundle in `@objectstack/platform-objects` is regenerated to match, and the translated locales keep their wording. The liveness ledger grades `userActions.exportCsv` `live`, so an authored `exportCsv: true` no longer raises the `liveness-dead-property` warning at `os lint` / `os validate`. Nothing needs migrating.
2 changes: 1 addition & 1 deletion content/docs/data-modeling/objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ indexes: [
| :--- | :--- | :--- |
| `isSystem` | `boolean` | System object, protected from deletion (default: `false`) |
| `managedBy` | `enum` | Lifecycle bucket that sets the default CRUD affordances and write policy — `'platform'` (default), `'config'`, `'system-data'`, `'engine-owned'`, `'append-only'`, `'synced'`, `'better-auth'`. See [Lifecycle bucket](#lifecycle-bucket-managedby) below. |
| `userActions` | `object` | Per-object override of the CRUD affordances the `managedBy` default implies — `{ create?, edit?, delete?, import?, exportCsv? }`. This is what NARROWS a `system-data` object, opens CSV `import` on one, or opens a verb on an `engine-owned`/`append-only` one. See [Lifecycle bucket](#lifecycle-bucket-managedby). |
| `userActions` | `object` | Per-object override of the CRUD affordances the `managedBy` default implies — `{ create?, edit?, delete?, import?, exportCsv? }`. This is what NARROWS a `system-data` object, opens CSV `import` on one, or opens a verb on an `engine-owned`/`append-only` one. `exportCsv: false` hides the Export entry that downloads the object's data (CSV, XLSX or JSON) on its grids, list views and dataset reports; a Gantt view's PNG / PDF export of its chart is not covered. It refuses no export request, since who may export is the permission set's `allowExport`. See [Lifecycle bucket](#lifecycle-bucket-managedby). |
| `sharingModel` | `enum` | Org-Wide Default record visibility (ADR-0055/0056/0090). Canonical four only: `'private'`, `'public_read'`, `'public_read_write'`, `'controlled_by_parent'` (detail visibility derived from its master). The legacy aliases (`'read'`, `'read_write'`, `'full'`) were removed from the enum (ADR-0090 D4) — authoring rejects them. Unset on a custom object resolves to `'private'` (ADR-0090 D1) |
| `ownership` | `enum` | Record-ownership model: `'user'` (default — injects the reassignable `owner_id` lookup, engaging owner-scoped RLS, "My" views and owner reports, plus `owning_business_unit_id`), `'business_unit'` (owned by an org unit rather than a person — injects `owning_business_unit_id` and deliberately **no** `owner_id`; ADR-0117 D1), `'org'`, or `'none'` (no per-record owner of either kind — Dataverse-style catalog / junction tables). Distinct from the package `own`/`extend` contribution kind. |
| `validations` | `ValidationRule[]` | Object-level validation rules (see [Validation](/docs/data-modeling/validation)) |
Expand Down
14 changes: 14 additions & 0 deletions content/docs/frontend/plugins/plugin-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ console passes `false` for a view authored `navigation: { mode: 'none' }` or
data API serves no single-record read (objectstack#33317, objectstack#33548,
objectstack#33549).

## The object's Export switch

The list's Export entry (the wide toolbar's button and the Display panel's
footer) follows the object as well as the view. An object that sets
`userActions.exportCsv: false` gets no Export entry for downloading its data,
in any of the list's formats (CSV, XLSX, JSON); the object grid and a dataset
report on that object hide theirs too. All three read one
verdict, `isObjectExportOffered(objectDef, effectiveApiOperations)` from
`@object-ui/core`: the authored switch over the object's `managedBy`
default, ANDed with the caller's effective `export` API operation. Unset, the
switch is on in every bucket. It hides the entry and is not a permission: who
may export is the permission set's `allowExport`. A Gantt view's PNG and PDF
export of the chart it draws is not covered by the switch.

## Status

This plugin is part of the v3.3.0 release. For full API reference and usage
Expand Down
2 changes: 1 addition & 1 deletion content/docs/references/data/object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const result = ApiMethod.parse(data);
| **import** | `boolean \| { enabled?: boolean; visibleWhen?: string \| object; disabledWhen?: string \| object }` | optional | Show CSV import wizard entry. Boolean, or an object adding visibleWhen/disabledWhen CEL predicates evaluated once per toolbar against the record in scope (the host record on a related list). |
| **edit** | `boolean \| { enabled?: boolean; visibleWhen?: string \| object; disabledWhen?: string \| object }` | optional | Allow inline / form edit of existing rows. Boolean, or an object adding per-record visibleWhen/disabledWhen CEL predicates. |
| **delete** | `boolean \| { enabled?: boolean; visibleWhen?: string \| object; disabledWhen?: string \| object }` | optional | Show row-level delete + bulk delete. Boolean, or an object adding per-record visibleWhen/disabledWhen CEL predicates. |
| **exportCsv** | `boolean` | optional | Show CSV export entry. |
| **exportCsv** | `boolean` | optional | Show the Export entry that downloads this object's data as CSV, XLSX or JSON: the grid's Export menu and its table CSV button, the list view's Export, and a dataset report's Export over this object; false hides it. A view's export of the picture it draws (the Gantt chart's PNG / PDF) is not covered. Omitted: shown, in every managedBy bucket. It hides the entry and refuses no export request: who may export is the permission set's allowExport. |
| **transfer** | `boolean \| { enabled?: boolean; visibleWhen?: string \| object; disabledWhen?: string \| object }` | optional | Offer the Change Owner action (single and bulk) on records of this object. Boolean, or an object adding per-record visibleWhen/disabledWhen CEL predicates. Omitted: on, except off on a controlled_by_parent detail. Offered only where the platform injects a reassignable owner_id that is provable and not declared readonly (ownership user or omitted, no managedBy, not a sys_ object; an external object declares owner_id or maps a remote column onto it); enabled: true elsewhere is refused. Gates the action, not a plain owner_id write. Resolved by resolveUserActionTransfer. |

### Nested Shape: `Object.systemFields`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
},
"userActions.exportCsv": {
label: "Export CSV",
helpText: "The CSV export entry. Unset: shown, since every managedBy bucket offers export."
helpText: "The Export entry that downloads this object's data (CSV, XLSX or JSON) on its grids, list views and dataset reports: on shows it, off hides it. A Gantt chart's PNG / PDF export is not covered. Unset: shown, since every managedBy bucket offers export. It is not a permission: who may export is the permission set's allowExport."
},
"userActions.transfer": {
label: "Change Owner",
Expand Down
11 changes: 6 additions & 5 deletions packages/spec/liveness/object.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"status": "live",
"verifiedAt": "2026-11-19",
"evidence": "packages/spec/src/data/object.zod.ts#resolveCrudAffordances (collapses `obj.userActions` onto the managedBy bucket's default row, the one resolution of the five CRUD entries); ui/packages/core/src/utils/managedBy.ts#resolveEffectiveCrudAffordances (hands the object's `userActions` to it and intersects the answer with the server's effective API operations)",
"note": "Drilled 2026-11-19 when `transfer` (the Change Owner switch, ruling 7000907189 point 1, card #35401) landed beside the five CRUD entries with a different verdict: the container used to carry one blanket `live` (\"objectui ObjectGrid per-object CRUD.\") and was recorded in undrilled-containers.baseline.json, so its children had no verdict of their own. Each child below is graded by its own reader, measured at this tree: create/import/edit/delete read through resolveCrudAffordances by the server write guard, the apiMethods reconciliation, the /me/permissions clamp and the console's affordance rows; exportCsv by nothing past the resolver (see its row); transfer by nothing yet (planned).",
"note": "Drilled 2026-11-19 when `transfer` (the Change Owner switch, ruling 7000907189 point 1, card #35401) landed beside the five CRUD entries with a different verdict: the container used to carry one blanket `live` (\"objectui ObjectGrid per-object CRUD.\") and was recorded in undrilled-containers.baseline.json, so its children had no verdict of their own. Each child below is graded by its own reader, measured at this tree: create/import/edit/delete read through resolveCrudAffordances by the server write guard, the apiMethods reconciliation, the /me/permissions clamp and the console's affordance rows; exportCsv by the console's export entries through isObjectExportOffered (see its row; it was graded dead on 2026-11-19 and flipped live on 2026-11-21 when those entries were wired, #35619); transfer by nothing yet (planned).",
"children": {
"create": {
"status": "live",
Expand All @@ -268,10 +268,11 @@
"evidence": "packages/plugins/plugin-security/src/system-write-guard.ts#assertEngineOwnedWriteAllowed (a user-context `delete`, `purge` or `restore` on an engine-owned bucket needs the resolved `delete`); packages/spec/src/data/managed-api-affordance.ts#checkManagedApiMethodAffordances (apiMethods `delete` against the resolved `delete`); packages/core/src/security/effective-object-permissions.ts#clampManagedObjectWrites (reads `userActions.delete`); ui/packages/core/src/utils/affordanceGrants.ts#resolveAffordance (the `rowDelete`, `recordDelete`, `listBulkDelete` and related-list rows read the resolved `delete` and `deletePredicates`); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (per-row delete verdict and `objectDeletePredicates`)"
},
"exportCsv": {
"status": "dead",
"verifiedAt": "2026-11-19",
"authorHint": "Remove it: no export menu reads it, so it neither shows nor hides CSV export. The export entry follows the view's exportOptions and the object's effective API operations.",
"note": "Measured 2026-11-19 while drilling this container, by closing the call graph by hand: the key's only reader is packages/spec/src/data/object.zod.ts#resolveCrudAffordances, which copies it onto `CrudAffordances.exportCsv`, and nothing reads that bit. Server side: plugin-security's WRITE_OP_AFFORDANCE and the spec's MANAGED_WRITE_VERB_AFFORDANCE map only create/edit/delete, and core's clampManagedObjectWrites reads only create/edit/delete. Console side: ui/packages/core/src/utils/managedBy.ts#resolveEffectiveCrudAffordances only ANDs the bit with the effective `export` operation, AFFORDANCE_GRANTS has no export row (its `crud` column is create/import/edit/delete), and the export menus (ui/packages/plugin-grid/src/ObjectGrid.tsx `exportEnabled`, ui/packages/plugin-list/src/ListView.tsx `exportPermitted`, ui/packages/plugin-detail/src/RelatedList.tsx, ui/packages/plugin-report/src/ReportExport.tsx) gate on `exportOptions`, `operations.export`, `allowExport` and the effective `export` operation, never on it. `git grep exportCsv` over packages/ and ui/ at this tree returns the declaration, the resolver, the form row, the FLS table (`keep`) and tests only. So `exportCsv: false` does not hide the export entry. Its blanket `live` came from the container's undrilled verdict; drilling may not fan that out (README, Granularity). Enforce-or-remove (ADR-0049) is owed: wire the console export menus to the resolved bit, or retire the key."
"status": "live",
"verifiedAt": "2026-11-21",
"evidenceScope": "in-repo",
"evidence": "ui/packages/core/src/utils/managedBy.ts#isObjectExportOffered (the resolved `exportCsv` bit, through resolveEffectiveCrudAffordances, which hands the object's `userActions` to resolveCrudAffordances and ANDs the bit with the effective `export` API operation: the one export verdict every entry below reads); ui/packages/plugin-grid/src/ObjectGrid.tsx#ObjectGrid (`objectExportOffered`: the toolbar Export menu, its handler and the table's own CSV button); ui/packages/plugin-list/src/ListView.tsx#ListView (`exportPermitted`: the wide toolbar's Export, the Display panel's export footer and the export handler); ui/packages/plugin-report/src/ReportExport.tsx#ReportExportControl (the dataset report's Export, on the query answer's base object, whose definition it reads through the report's data source)",
"note": "Flipped dead → live 2026-11-21 (#35619, ruling 7035537883: enforce). `exportCsv: false` hides the data Export entry (the CSV / XLSX / JSON download: the grid's Export menu and table CSV button, the list view's Export, the dataset report's Export), matching the `exportCsv → export` operation mapping in resolveEffectiveCrudAffordances; a view's export of the picture it draws is not covered (the Gantt view's PNG / PDF buttons in ui/packages/plugin-gantt/src/GanttView.tsx read no export verdict); the bucket defaults (ADR-0103, `exportCsv: true` in every bucket) are unchanged, so an object that does not author the key keeps its entry. It is a console affordance, not a permission: no server door reads it (plugin-security's WRITE_OP_AFFORDANCE, the spec's MANAGED_WRITE_VERB_AFFORDANCE and core's clampManagedObjectWrites map only create/edit/delete), and who may export stays the permission set's allowExport through the effective `export` operation. RelatedList (ui/packages/plugin-detail/src/RelatedList.tsx) offers no export entry at this tree: its table is drawn with `exportable: false`, its enlarged grid carries no `exportOptions`, and its toolbar has no export control, so there is nothing there to gate. Pinned per surface by the `*-35619` render tests beside each reader, each with a CONTROL that the default still shows the entry."
},
"transfer": {
"status": "planned",
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/liveness/state-counts/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them.

| Type | live | exp | elsewhere | dead | planned | classified |
|---|---|---|---|---|---|---|
| `object` | 85 | 0 | 0 | 2 | 2 | 89 |
| `object` | 86 | 0 | 0 | 1 | 2 | 89 |
2 changes: 1 addition & 1 deletion packages/spec/src/data/object.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ export const objectForm = defineForm({
{ field: 'import', label: 'Import', widget: 'json', helpText: 'The CSV import entry: on shows it, off hides it. A stored {enabled, visibleWhen, disabledWhen} object is edited key by key; write one in source to gate the entry on the record in scope, evaluated once per toolbar.' },
{ field: 'edit', label: 'Edit', widget: 'json', helpText: 'Editing existing records, inline and in the form: on offers it, off hides it. A stored {enabled, visibleWhen, disabledWhen} object is edited key by key; write one in source to gate each row on its own record.' },
{ field: 'delete', label: 'Delete', widget: 'json', helpText: 'Row and bulk delete: on offers it, off hides it. A stored {enabled, visibleWhen, disabledWhen} object is edited key by key; write one in source to gate each row on its own record.' },
{ field: 'exportCsv', label: 'Export CSV', type: 'boolean', helpText: 'The CSV export entry. Unset: shown, since every managedBy bucket offers export.' },
{ field: 'exportCsv', label: 'Export CSV', type: 'boolean', helpText: 'The Export entry that downloads this object\'s data (CSV, XLSX or JSON) on its grids, list views and dataset reports: on shows it, off hides it. A Gantt chart\'s PNG / PDF export is not covered. Unset: shown, since every managedBy bucket offers export. It is not a permission: who may export is the permission set\'s allowExport.' },
{ field: 'transfer', label: 'Change Owner', widget: 'json', helpText: 'The Change Owner action, single and bulk: on offers it, off hides it. Unset: on, except off on a controlled_by_parent detail. Offered only on an object whose records have a reassignable owner (ownership user or unset, no managedBy, not a sys_ object, owner_id not readonly and, on an external object, declared or mapped); turning it on anywhere else is refused. It gates the action only, not a plain edit of owner_id. A stored {enabled, visibleWhen, disabledWhen} object is edited key by key; write one in source to gate the action on each record.' },
],
},
Expand Down
Loading
Loading