K-3: docs — fields that hold a list, a relationship counts, a rule of your own replaces the protection, known limitations

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 03:44:25 +01:00
co-authored by Claude Fable 5.2
parent c3d95988e1
commit 4c7b722aed
9 changed files with 62 additions and 25 deletions
+30 -8
View File
@@ -13,7 +13,8 @@ once there are more than 20.
> **Read before upgrading.** No option, schema, migration or import-map change. Two points:
> **What can stop people:** on a project's own staff collection **without access rules of its own** whose
> accounts can hold `editor` or `admin` although its roles are not just the plugin's — a `roles` select such as
> `user, editor, admin, boss` or `viewer, editor`, or a `roles` field that is text or json — an account that is
> `user, editor, admin, boss` or `viewer, editor`, or a `roles` field that is text, json or a relationship (all
> with `hasMany`, i.e. holding a list; a single-valued field is not affected) — an account that is
> not an admin can no longer create, delete or unlock accounts there, change another account, or change
> anybody's roles. If **no** staff account holds `admin`, nobody can (the start log says so; the way out is
> below). And a site **built with Turbopack** (`next build` without `--webpack`): see Security.
@@ -26,7 +27,8 @@ once there are more than 20.
collection" could create, change and delete accounts. So with roles `user, editor, admin, boss` an account
with the role `user` created an `admin` there (or set the admin's password) and then read Site integrations,
changed other staff collections' roles and listed the panel's accounts; with `viewer, editor` a `viewer` made
an `editor` who saves Site settings; the same with a `roles` field that is text or json. In 1.16.7 and, wider,
an `editor` who saves Site settings; the same with a `roles` field that is text or a relationship with
`hasMany`, or json (a relationship to documents with text ids holds those ids). In 1.16.7 and, wider,
before it. Now such a collection — in the config or added by a later plugin — gets: create, delete, unlock —
an admin; update — an admin or the account itself; roles — only an admin. Not affected: `access.authCollection`,
collections with rules of their own, a `roles` select whose values hold neither `editor` nor `admin`. No known
@@ -42,16 +44,18 @@ once there are more than 20.
disk at run time.
### Added
- A start-log warning when staff collections run on the admin rules and no staff account holds `admin`.
- A start-log warning when staff collections run on the admin rules and no staff account holds `admin`
(checked collection by collection; "could not check" where it cannot tell).
- `pnpm e2e:built` (plugin repository): builds the reference site with webpack and with Turbopack and checks,
on each, the account rules on a built site and that no package manifest is among the public files. Part of
the release gate (PROGRAMISTA §8.1). The reference site's Playwright runs reset the test admins first
(`e2e/global-setup.ts`), so a spec no longer fails because of what ran before it.
- Exports: `canHoldStaffRole`, `staffCollectionsNobodyManages`.
- Exports: `canHoldStaffRole`, `rolesAreAList`, `staffCollectionsNobodyManages`.
### Requires project changes
- **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a
`roles` select with one of them next to values of your own, or a text / json `roles` field): only an admin
`roles` select with `hasMany` and one of them next to values of your own, or a `roles` field that is text or a
relationship with `hasMany`, or json): only an admin
creates, deletes and unlocks accounts there and changes roles; another account is changed by an admin or by
itself. If accounts with a role of your own (`boss`, `viewer`) managed accounts there, write that as the
collection's own rules (`access.create` / `update` / `delete`, field access on `roles`) — the plugin gives
@@ -67,13 +71,31 @@ once there are more than 20.
webpack build.
- `pnpm ipal:skills`.
### Changed
- **A single-valued `roles` field no longer brings the admin rules.** The plugin counts roles only from an array,
so an account whose `roles` is one value (`'admin'` in a select without `hasMany`, a radio) was never a plugin
admin. Yet in 1.16.7 a project's own staff collection whose single select offered only `user` / `editor` /
`admin` got the admin rules — and then nobody in it could create, delete or unlock accounts, unless a plugin
admin existed in another staff collection. Such a collection now gets "an account of this collection", like any
collection whose roles are not the plugin's: its accounts manage each other again. Nothing of the plugin's opens:
the value still grants nothing.
### Known limitations
- **Copied staff collections behave as in 1.16.7**: a plugin listed after ipalKit that spreads a staff collection
into a new slug (`{ ...staff, slug: 'copy' }`) keeps the rules written for the original, so with numeric ids
(Postgres, SQLite) the original's account with the same id can change the copy's account. Not changed in this
release; no known site copies a staff collection.
- A staff collection **without a `roles` field** is unchanged: every account of it is an admin to the plugin.
- A `roles` select of your own whose values hold neither `editor` nor `admin` is unchanged: inside it every
account may create, change and delete accounts (`ipal-doctor --url` → `staff-own-roles`).
- The warning counts accounts whose `roles` hold `admin`; where a `roles` field cannot be queried it says nothing.
- **Not run for this change:** the starter built with Turbopack (it is generated from the reference site and uses
the same plugin code; the reference site was built with both bundlers).
- The plugin judges a collection by its declared `roles` field. A value that a hook of the project's own puts
into `roles` is not seen, and a rule of the project's own (`access.create`, field access on `roles`) replaces
the protection for that operation.
- A relationship `roles` field makes a plugin admin only where the related documents' ids are the role names; over
REST such an account's roles arrive as documents and do not count, over GraphQL and the Local API at depth 0
they do. The admin rules apply to the collection either way.
- The start-log check reads up to 1000 accounts of a collection whose `roles` field the database cannot be asked
about; with more it says "could not check" for that collection.
## 1.16.7 — hardening