Skip to content

Commit 3c7d7dd

Browse files
committed
docs(rest): the template's changeset and permission docs name the import door's gates (#20896)
Claude-Session: https://claude.ai/code/session_01Sfe5YjBLwB9J3y8fvm2xq1 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 617255a commit 3c7d7dd

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎.changeset/18386-export-import-template.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ Without a `template` parameter the export is exactly as before, byte for byte.
3030
- **Language.** The sheets are in Chinese for a `zh` request locale
3131
(`?locale=` or `Accept-Language`) and in English otherwise.
3232

33-
The same two permission checks as the export apply: an object that does not
34-
expose export answers `405`, and a caller without the export permission answers
35-
`403`. `template` with a value other than `true` or `false`, a `format` other
33+
The import's permission checks apply, not the export's: an object that exposes
34+
neither create nor update answers `405`, and a caller without the create
35+
permission on the object answers `403`. The export permission (`allowExport`) is
36+
not needed. `template` with a value other than `true` or `false`, a `format` other
3637
than `xlsx`, or any of `limit`, `page`, `filter`, `search`, `searchFields`,
3738
`orderby` or `header` beside `template=true`, answers `400 VALIDATION_ERROR`.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
fix(rest): the import template (`GET /api/v1/data/:object/export?template=true`) is gated by the import door's permissions, not the export's
6+
7+
Clause-②: no
8+
9+
The template carries no records — only the columns the caller may write, one
10+
example row and an instructions sheet — so it answers to whoever may import, and
11+
the export permission (`allowExport`) neither admits nor refuses it:
12+
13+
- A caller with the create permission on the object gets the template, with or
14+
without `allowExport`.
15+
- A caller without the create permission gets `403 PERMISSION_DENIED`, with or
16+
without `allowExport`.
17+
- An object whose `enable.apiMethods` exposes neither `create` nor `update`
18+
answers `405 OBJECT_API_METHOD_NOT_ALLOWED`, as `POST /api/v1/data/:object/import`
19+
does. An object that exposes `create` without `list` serves the template.
20+
- Without `template=true` the export is unchanged: the same two export checks
21+
and the same bytes.
22+
23+
To let a role download the template, grant it create on the object.

‎content/docs/permissions/permission-sets.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ opt-in. Grant it through an ordinary position-distributed set instead.
9595
Enforcement is server-side and covers both egress doors:
9696

9797
- `GET /api/v1/data/:object/export` answers `403 EXPORT_NOT_PERMITTED` before it
98-
reads the first row.
98+
reads the first row. Its import template (`?template=true`) is not a copy of
99+
data — it carries no records — so it is gated by the import instead: the create
100+
permission on the object, never `allowExport`.
99101
- A **report** rendered as `csv` or `json` is the same bulk copy and is gated the
100102
same way, whether run interactively or delivered by a schedule. `html_table`
101103
is a rendered view and stays a read.

0 commit comments

Comments
 (0)