diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b95a81f..89e3da1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,56 +8,21 @@ versions at once, go through every "Requires project changes" section in order, version you have. A new release = a new section at the top; we remove the oldest ones only once there are more than 20. -## Unreleased — copied staff collections (version to be set at release; after the security follow-ups below) - -> No option, schema, migration or import-map change. Matters only to a project in which a plugin listed after -> ipalKit **copies a staff collection** under a new slug or reuses its `access` object. No known site does. - -### Security -- **A copy of a staff collection kept rules written for the original.** A plugin listed after ipalKit that - spreads a staff collection into another slug (`{ ...staff, slug: 'copy' }`) carried the "already handled" marker - and the plugin's rules along. "An admin, or the account itself" then meant the ORIGINAL's accounts: with - numeric ids (Postgres, SQLite) an account of the original could change the password of the account with the - same id in the copy. Now the plugin puts its rule for the copy's own slug **in front of** every rule it wrote - for the original, and both must allow; on a copy named as staff, in front of every rule. Nothing is replaced - or rewritten, so a copy is never opened wider than it was and never wider than the plugin's rule — whatever - role values it has and however it uses or wraps the copied rules. Its `roles` field is guarded on every copy. - The marker `custom.ipalAccounts` names the slug and the staff status (`{ slug, staff }`). - -### Fixed -- `next dev`: a collection that becomes a staff collection in an edit (named in `access.staffCollections` for - the first time) gets its rules on the reload; it needed a restart when its config object outlived the reload. -- A plain 2FA config guards nothing twice at start (the plugin's rules are marked before its 2FA guard). - -### Added -- Exports: `staffRuleOf`, `isPasswordRuleHook`; types `StaffRuleMark`, `AccountsMarker`. - `markSeenAuthCollections(config, staffSlugs)` takes the staff slugs. -- `pnpm e2e:built` covers copied staff collections on the built site (both bundlers). - -### Requires project changes -- **Only if a plugin of yours copies a staff collection:** in the copy, the copied rule "an admin, or the account - itself" lets only an admin through (it still speaks of the original's accounts). If the copy's own accounts - should edit themselves, give the copy its own rule — one line: - `access: { ...staff.access, update: adminOrSelfIn('copy') }` ([access.md](./access.md) "Account rules"). - Before this change those accounts could not edit themselves either. -- `pnpm ipal:skills`. - -### Known limitations -- `next dev`: a collection that STOPS being a staff collection in an edit keeps the rules until a restart; after - a reload the adoption still runs with the options the site started with. -- A marker or a function mark written by hand in the project's own config is taken at its word ("handled" for a - marker of the collection's own slug); a hand-made function mark only ever adds the plugin's rule in front. - ## Unreleased — security follow-ups to 1.16.7 (version to be set at release) -> **Read before upgrading.** No option, schema, migration or import-map change. Two points: +> **Read before upgrading.** No option, schema, migration or import-map change. Three points: +> **A site built with Turbopack** (`next build` without `--webpack`) published the plugin's `package.json`: +> update and rebuild (see Security). > **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, 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. +> below). +> **Only where a plugin listed after ipalKit copies a staff collection, or makes a collection of your config the +> panel's** (`admin.user`): some answers get narrower there — see "Requires project changes". No known site does +> either. ### Security - **A staff collection whose accounts can hold `editor` or `admin` gets the admin rules.** The plugin's checks go @@ -73,6 +38,21 @@ once there are more than 20. 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 site has such a collection ([access.md](./access.md) "Account rules"). +- **A copy of a staff collection kept rules written for the original.** A plugin listed after ipalKit that + spreads a staff collection into another slug (`{ ...staff, slug: 'copy' }`) carried the "already handled" marker + and the plugin's rules along. "An admin, or the account itself" then meant the ORIGINAL's accounts: with + numeric ids (Postgres, SQLite) an account of the original could change the password of the account with the + same id in the copy. Now the plugin puts its rule for the copy's own slug **in front of** every rule it wrote + for the original, and both must allow; on a copy named as staff, in front of every rule. Nothing is replaced + or rewritten, so a copy is never opened wider than it was and never wider than the plugin's rule — whatever + role values it has and however it uses or wraps the copied rules. Its `roles` field is guarded on every copy. + The marker `custom.ipalAccounts` names the slug and the staff status (`{ slug, staff, own? }`). +- **A collection of the config that a later plugin makes the panel's had no account rules.** A collection that is + in your config, is not named as staff, and becomes the login collection because a plugin listed after ipalKit + sets `admin.user` to it counted as "already handled": where it had no rules of its own, Payload's defaults + stood — an account of any auth collection (a customer) could create, change and delete panel accounts there. + Now it gets the plugin's rules when the config goes live, for every operation that had **no** rule in your + config; an operation you wrote a rule for keeps it exactly as written (`AccountsMarker.own`). - **A Turbopack build of a site published the plugin's `package.json`.** The plugin read its own version from that file by a path relative to its module, and a bundler takes such a file for an asset: Turbopack copied it to `/_next/static/media/package..json`, where anyone could fetch it. It is the **plugin's** manifest, not @@ -83,14 +63,24 @@ once there are more than 20. server side: not served. The version is now a constant in the code (`src/version.ts`); nothing is read from disk at run time. + +### Fixed +- `next dev`: a collection that becomes a staff collection in an edit (named in `access.staffCollections` for + the first time) gets its rules on the reload; it needed a restart when its config object outlived the reload. +- A plain 2FA config guards nothing twice at start (the plugin's rules are marked before its 2FA guard). + ### Added - 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`, `rolesAreAList`, `staffCollectionsNobodyManages`. + on each, the account rules on a built site (copied staff collections included) 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`, `rolesAreAList`, `staffCollectionsNobodyManages`, `staffRuleOf`, + `isPasswordRuleHook`; types `StaffRuleMark`, `AccountsMarker`. `markSeenAuthCollections(config, staffSlugs)` + takes the staff slugs; `LateAdoption` has `kept` and `known`. +- The start log tells a collection that became staff after ipalKit ran from one a later plugin added, and names + the rules of its own that were kept. ### Requires project changes - **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a @@ -109,6 +99,25 @@ once there are more than 20. - **A site built with Turbopack:** update and rebuild — the new build has no `package..json` under `/_next/static/media/`. Check: `find .next/static -name 'package*.json'` prints nothing. Nothing to do for a webpack build. +- **Only if a plugin of yours copies a staff collection** (`{ ...staff, slug: 'copy' }`, or a new collection that + reuses a staff collection's `access` object) — three answers get narrower: + - **The copy's own accounts and "the account itself".** In the copy, the copied rule "an admin, or the account + itself" lets only an admin through (it still speaks of the original's accounts). If the copy's own accounts + should edit themselves, give the copy its own rule — one line: + `access: { ...staff.access, update: adminOrSelfIn('copy') }` ([access.md](./access.md) "Account rules"). + Before this change those accounts could not edit themselves either. + - **A copy named as staff whose own rules were wider than the plugin's** — a public `read`, an open `create`, + a rule that returns a query, Payload's defaults where it dropped a rule: in 1.16.7 a copy counted as handled + and kept them; now the plugin's rule goes in front, so a customer or an anonymous request no longer passes. + To keep the copy's rules exactly as they are: `custom: { ipal: { accountRules: false } }` on the copy. + - **Where the original has roles of its own** (`lead, member`): its accounts could manage the copy's accounts + (create, change, delete) through the copied rule "an account of the original". They no longer can: only a + plugin admin manages the copy's accounts (the copy's own accounts could not before and cannot now), until + the copy writes rules of its own (`access.create` / `update` / `delete`). +- **Only if a plugin listed after ipalKit sets `admin.user` to a collection of your config that you did not name + as staff:** the operations that collection has no rule for get the plugin's (an admin; update — an admin or + the account itself; read — staff). Rules you wrote on it stay. Better: name it in `access.staffCollections` + (or list that plugin before ipalKit) — then it is handled at config time like any staff collection. - `pnpm ipal:skills`. ### Changed @@ -121,10 +130,6 @@ once there are more than 20. 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`). @@ -136,6 +141,10 @@ once there are more than 20. 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. +- `next dev`: a collection that STOPS being a staff collection in an edit keeps the rules until a restart; after + a reload the adoption still runs with the options the site started with. +- A marker or a function mark written by hand in the project's own config is taken at its word ("handled" for a + marker of the collection's own slug); a hand-made function mark only ever adds the plugin's rule in front. ## 1.16.7 — hardening diff --git a/docs/access.md b/docs/access.md index dbb681f..1e2c26c 100644 --- a/docs/access.md +++ b/docs/access.md @@ -355,6 +355,18 @@ is kept and can only narrow it. To keep a late collection's rules exactly as the wider `read` — say so on the collection: `custom: { ipal: { accountRules: false } }` (the password rule and the first-user endpoint still apply), or list that plugin before ipalKit. +**A collection of your own config that becomes staff later** — it is in the config, you did not name it as staff, +and a plugin listed after ipalKit sets `admin.user` to it — is handled at the same moment, with one difference: +the plugin saw it at config time and wrote down which operations had a rule of yours (the marker's `own`). **Those +rules stay exactly as written; an operation that had no rule gets the plugin's** — the same result as for a +collection named in `access.staffCollections`, and its `roles` field is guarded where the plugin's `update` rule +is the one in force. The log: `[ipal] "people" became a staff collection after ipalKit ran: put on it — access +rules for update, delete, unlock, read, readVersions, roles; the password rule. Its own rules for create are kept +as written.` Without rules of its own such a collection ran on Payload's defaults before (any signed-in account, +a customer included, created and changed panel accounts). Simpler and clearer: name the collection in +`access.staffCollections`, or list that plugin before ipalKit. Verify: sign in as an account of a non-staff +collection and `POST /api/` — 403 unless your own `create` rule lets it through. + **A copy of a staff collection** — a later plugin that spreads one into a new slug (`{ ...staff, slug: 'copy' }`), or a new collection that reuses a staff collection's `access` object — brings along rules the plugin wrote for the ORIGINAL: "an account of `staff`", "the account itself" = one of the original's. The plugin sees them by a @@ -387,8 +399,9 @@ import { adminOrSelfIn } from '@intecion/ipal-kit' A rule you write there is not marked, so on a staff copy it is combined with the plugin's rule for `copy` ("an admin, or the account itself" of the copy) and works. The password rule is on a copy once -(`isPasswordRuleHook`). The marker `custom.ipalAccounts` (`{ slug, staff }`, type `AccountsMarker`) records which -collection the plugin has handled and whether as staff: a copy carries the original's marker and is handled under +(`isPasswordRuleHook`). The marker `custom.ipalAccounts` (`{ slug, staff, own? }`, type `AccountsMarker`) records which +collection the plugin has handled, whether as staff, and — for a collection that was not staff at config time — +which operations had a rule of the project's then (`own`): a copy carries the original's marker and is handled under its own slug; in `next dev` a collection named as staff in an edit is handled on the reload. A marker for the collection's own slug means "handled" — only your own config can write one, like `accountRules: false`. diff --git a/docs/agent/skills/ipal-debug/SKILL.md b/docs/agent/skills/ipal-debug/SKILL.md index c0268f2..a205f46 100644 --- a/docs/agent/skills/ipal-debug/SKILL.md +++ b/docs/agent/skills/ipal-debug/SKILL.md @@ -110,6 +110,7 @@ through this procedure. Ask only when you are missing something you cannot get y | an account saves its own profile and its `roles` do not change (no error) | `accounts.adminOnlyWrite`: nobody changes its own roles; with the plugin's roles only an admin changes roles | an admin changes the role; or give the `roles` field its own `access.update` | | a logged-in visitor (customer) gets `403` reading a staff collection — an author box went empty | `accounts.staffOnlyRead`: only staff accounts read a staff collection without a `read` rule | write that collection's `read` rule; or `staffOnlyRead: false` | | `/api/health` answers 503, the panel and `/api/*` 500 after a deploy; log: `[ipal] access names "…" as a staff collection, but this config has no auth collection with that slug` | a slug in `access.staffCollections` / `access.authCollection` is not an auth collection (a typo, a removed collection): Payload does not start, the process stays up (with a health check Coolify keeps the old container) | fix the slug or add the collection | +| the log says `"" became a staff collection after ipalKit ran` | a plugin listed after ipalKit set `admin.user` to a collection of your config that is not named as staff: the operations without a rule of yours got the plugin's, yours are kept (named in the same line) | name the collection in `access.staffCollections` (or `access.authCollection`), or list that plugin before ipalKit | | a collection added by a plugin listed after ipalKit refuses what its own access rule allows | it is in `access.staffCollections`: the plugin's account rules are put in front of its rules and both must allow (the log at start lists what was put) | `custom: { ipal: { accountRules: false } }` on that collection, or list that plugin before ipalKit | | a fresh site with `access.firstUserAdmin: false`: the first account sees "Unauthorized", or the start fails with `leaves a fresh site with nobody who can open the panel` | the first account gets the default role, below the panel role | `access.defaultRole: 'editor'`, or `accounts: { panelRole: false }`, or drop `firstUserAdmin: false` | | saving Site integrations fails on the password field: "Enter the password again…" | the server, port or user name changed and the stored SMTP password is kept only for the settings it was saved with — also when the transport says Microsoft Graph | type the password again; or "Remove the stored value" for a server without one; a seed with the Local API is not asked; `secrets: { reenterOnChange: false }` | diff --git a/docs/agent/skills/ipal-reference/resources/api.md b/docs/agent/skills/ipal-reference/resources/api.md index c044987..57afbeb 100644 --- a/docs/agent/skills/ipal-reference/resources/api.md +++ b/docs/agent/skills/ipal-reference/resources/api.md @@ -82,7 +82,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. | | `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. | -**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff }`, in `custom.ipalAccounts`), `LateAdoption` (`{ slug, applied, password, firstUser }`), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`). +**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when ipalKit ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`). ## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md` diff --git a/docs/agent/skills/ipal-setup/SKILL.md b/docs/agent/skills/ipal-setup/SKILL.md index 858bc1f..3ca0a81 100644 --- a/docs/agent/skills/ipal-setup/SKILL.md +++ b/docs/agent/skills/ipal-setup/SKILL.md @@ -259,7 +259,9 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo one each of its accounts is an admin to the plugin. Every slug in `access.staffCollections` must be an auth collection of the config, or Payload does not start (`/api/health` 503, the slug in the log); a staff collection from a plugin listed after ipalKit gets the rules in front of its own (`custom: { ipal: { accountRules: false } }` - on it keeps its own as they are); Payload's first-user route answers only for the + on it keeps its own as they are); a collection of the config that a later plugin makes the panel's (`admin.user`) + keeps the rules you wrote and gets the plugin's for the rest — name the login collection in + `access.staffCollections` so it is handled at config time; Payload's first-user route answers only for the panel's login collection (`firstUserRoute`) — so **create the first account right after the first deploy**, it becomes the admin; a new password has at least 12 characters (`password`). A customer collection with sign-up: write its own `create: () => true`; the rules do not touch it. Do not combine diff --git a/docs/agent/skills/ipal-upgrade/SKILL.md b/docs/agent/skills/ipal-upgrade/SKILL.md index 3966a74..724605e 100644 --- a/docs/agent/skills/ipal-upgrade/SKILL.md +++ b/docs/agent/skills/ipal-upgrade/SKILL.md @@ -477,6 +477,12 @@ account → "Two-step verification: Set up." and the reset button; delete the ac A staff collection added by a plugin listed after ipalKit gets the same rules at start, put in FRONT of the rules it has (both must allow). If that plugin's collection needs a rule wider than the plugin's default, set `custom: { ipal: { accountRules: false } }` on it. + From the release after 1.16.7: a **copy** of a staff collection made by such a plugin (`{ ...staff, slug: 'copy' }`) + gets the plugin's rule for its own slug in front of the copied rules — the copy's accounts edit themselves only + after `access: { ...staff.access, update: adminOrSelfIn('copy') }`, and the original's accounts no longer manage + the copy's. A collection of your config that such a plugin makes the panel's (`admin.user`) keeps the rules you + wrote and gets the plugin's for the operations without one — name it in `access.staffCollections` instead + (docs/access.md "Account rules"; the start log says what was put and what was kept). `first-register` on any auth collection other than the panel's login collection answers `403` unless that collection allows sign-up. `access.firstUserAdmin: false` with a default role below `editor`: the panel role is not applied (a warning at start), or — with `accounts.panelRole` set — the start fails with the fix in the diff --git a/reference/.agents/skills/ipal-debug/SKILL.md b/reference/.agents/skills/ipal-debug/SKILL.md index c0268f2..a205f46 100644 --- a/reference/.agents/skills/ipal-debug/SKILL.md +++ b/reference/.agents/skills/ipal-debug/SKILL.md @@ -110,6 +110,7 @@ through this procedure. Ask only when you are missing something you cannot get y | an account saves its own profile and its `roles` do not change (no error) | `accounts.adminOnlyWrite`: nobody changes its own roles; with the plugin's roles only an admin changes roles | an admin changes the role; or give the `roles` field its own `access.update` | | a logged-in visitor (customer) gets `403` reading a staff collection — an author box went empty | `accounts.staffOnlyRead`: only staff accounts read a staff collection without a `read` rule | write that collection's `read` rule; or `staffOnlyRead: false` | | `/api/health` answers 503, the panel and `/api/*` 500 after a deploy; log: `[ipal] access names "…" as a staff collection, but this config has no auth collection with that slug` | a slug in `access.staffCollections` / `access.authCollection` is not an auth collection (a typo, a removed collection): Payload does not start, the process stays up (with a health check Coolify keeps the old container) | fix the slug or add the collection | +| the log says `"" became a staff collection after ipalKit ran` | a plugin listed after ipalKit set `admin.user` to a collection of your config that is not named as staff: the operations without a rule of yours got the plugin's, yours are kept (named in the same line) | name the collection in `access.staffCollections` (or `access.authCollection`), or list that plugin before ipalKit | | a collection added by a plugin listed after ipalKit refuses what its own access rule allows | it is in `access.staffCollections`: the plugin's account rules are put in front of its rules and both must allow (the log at start lists what was put) | `custom: { ipal: { accountRules: false } }` on that collection, or list that plugin before ipalKit | | a fresh site with `access.firstUserAdmin: false`: the first account sees "Unauthorized", or the start fails with `leaves a fresh site with nobody who can open the panel` | the first account gets the default role, below the panel role | `access.defaultRole: 'editor'`, or `accounts: { panelRole: false }`, or drop `firstUserAdmin: false` | | saving Site integrations fails on the password field: "Enter the password again…" | the server, port or user name changed and the stored SMTP password is kept only for the settings it was saved with — also when the transport says Microsoft Graph | type the password again; or "Remove the stored value" for a server without one; a seed with the Local API is not asked; `secrets: { reenterOnChange: false }` | diff --git a/reference/.agents/skills/ipal-reference/resources/api.md b/reference/.agents/skills/ipal-reference/resources/api.md index c044987..57afbeb 100644 --- a/reference/.agents/skills/ipal-reference/resources/api.md +++ b/reference/.agents/skills/ipal-reference/resources/api.md @@ -82,7 +82,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. | | `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. | -**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff }`, in `custom.ipalAccounts`), `LateAdoption` (`{ slug, applied, password, firstUser }`), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`). +**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when ipalKit ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`). ## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md` diff --git a/reference/.agents/skills/ipal-setup/SKILL.md b/reference/.agents/skills/ipal-setup/SKILL.md index 858bc1f..3ca0a81 100644 --- a/reference/.agents/skills/ipal-setup/SKILL.md +++ b/reference/.agents/skills/ipal-setup/SKILL.md @@ -259,7 +259,9 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo one each of its accounts is an admin to the plugin. Every slug in `access.staffCollections` must be an auth collection of the config, or Payload does not start (`/api/health` 503, the slug in the log); a staff collection from a plugin listed after ipalKit gets the rules in front of its own (`custom: { ipal: { accountRules: false } }` - on it keeps its own as they are); Payload's first-user route answers only for the + on it keeps its own as they are); a collection of the config that a later plugin makes the panel's (`admin.user`) + keeps the rules you wrote and gets the plugin's for the rest — name the login collection in + `access.staffCollections` so it is handled at config time; Payload's first-user route answers only for the panel's login collection (`firstUserRoute`) — so **create the first account right after the first deploy**, it becomes the admin; a new password has at least 12 characters (`password`). A customer collection with sign-up: write its own `create: () => true`; the rules do not touch it. Do not combine diff --git a/reference/.agents/skills/ipal-upgrade/SKILL.md b/reference/.agents/skills/ipal-upgrade/SKILL.md index 3966a74..724605e 100644 --- a/reference/.agents/skills/ipal-upgrade/SKILL.md +++ b/reference/.agents/skills/ipal-upgrade/SKILL.md @@ -477,6 +477,12 @@ account → "Two-step verification: Set up." and the reset button; delete the ac A staff collection added by a plugin listed after ipalKit gets the same rules at start, put in FRONT of the rules it has (both must allow). If that plugin's collection needs a rule wider than the plugin's default, set `custom: { ipal: { accountRules: false } }` on it. + From the release after 1.16.7: a **copy** of a staff collection made by such a plugin (`{ ...staff, slug: 'copy' }`) + gets the plugin's rule for its own slug in front of the copied rules — the copy's accounts edit themselves only + after `access: { ...staff.access, update: adminOrSelfIn('copy') }`, and the original's accounts no longer manage + the copy's. A collection of your config that such a plugin makes the panel's (`admin.user`) keeps the rules you + wrote and gets the plugin's for the operations without one — name it in `access.staffCollections` instead + (docs/access.md "Account rules"; the start log says what was put and what was kept). `first-register` on any auth collection other than the panel's login collection answers `403` unless that collection allows sign-up. `access.firstUserAdmin: false` with a default role below `editor`: the panel role is not applied (a warning at start), or — with `accounts.panelRole` set — the start fails with the fix in the