IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft
- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms); past CHANGELOG entries and the proposals in docs/dev are not rewritten - AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames - iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required - env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup - skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were - reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
425fac14fb
commit
b91984fbcd
+19
-19
@@ -7,7 +7,7 @@ predicates and ready access functions (collection-level and field-level).
|
||||
## Config (payload.config.ts)
|
||||
|
||||
```ts
|
||||
ipalKit({
|
||||
iapl({
|
||||
access: {
|
||||
authCollection: 'users', // slug of your auth collection (required)
|
||||
// defaultRole: 'user', // role of new accounts
|
||||
@@ -50,7 +50,7 @@ only checks that someone is logged in.
|
||||
|
||||
```ts
|
||||
import { authenticated } from '@intecion/ipal-kit'
|
||||
ipalKit({
|
||||
iapl({
|
||||
access: { authCollection: 'users', authAccess: { read: authenticated } }, // editors see the account list
|
||||
globalOverrides: {
|
||||
notifications: { access: { update: authenticated } }, // any logged-in account edits the texts
|
||||
@@ -99,8 +99,8 @@ What follows:
|
||||
`access.staffCollections`. That is the one switch that makes its roles count. Without a `roles` field every
|
||||
partner passes every staff check, admin ones included; to tell them apart add the field:
|
||||
`fields: [buildRolesField('editor')]` in that collection. **2FA covers one collection** (`twoFactor.collectionSlug`,
|
||||
by default the panel's): accounts of a further staff collection are staff with a password alone. ipalKit says
|
||||
so in the log at start (`[ipal] 2FA covers "users" only…`); name such a collection only when that is acceptable.
|
||||
by default the panel's): accounts of a further staff collection are staff with a password alone. iapl says
|
||||
so in the log at start (`[iapl] 2FA covers "users" only…`); name such a collection only when that is acceptable.
|
||||
- **Payload's own default** for a collection or global without `access` is "any logged-in account" — an account
|
||||
of a visitor collection included. In a project with a second auth collection give every collection and global
|
||||
explicit `access` (`adminOrEditor`, `requireRole(…)`, …).
|
||||
@@ -134,7 +134,7 @@ which collections are staff:
|
||||
|
||||
| Where you call it | Pass | Without it |
|
||||
|---|---|---|
|
||||
| access functions, hooks, endpoints (server, the config is loaded) | `req.payload` | works: the staff collections of the config `ipalKit` built in this process. With two different configs in one process, only collections that are staff in **both** count — pass `req.payload` to get that config's own answer |
|
||||
| access functions, hooks, endpoints (server, the config is loaded) | `req.payload` | works: the staff collections of the config `iapl` built in this process. With two different configs in one process, only collections that are staff in **both** count — pass `req.payload` to get that config's own answer |
|
||||
| client components — import from **`@intecion/ipal-kit/client`** | the config from `useConfig()` (it has `admin.user`, the panel's login collection), or `{ staffCollections: ['users', …] }` | **always `false`** — the browser bundle has no config |
|
||||
| Next middleware / `proxy.ts`, the edge runtime | `{ staffCollections: ['users'] }` | **always `false`** — the config is not loaded there |
|
||||
|
||||
@@ -222,15 +222,15 @@ injectRoles(config, { authCollection: 'members' }) // add the field to a
|
||||
applyGlobalOverrides(globals, { notifications: { … } }) // the same logic as the globalOverrides option
|
||||
```
|
||||
|
||||
Types: `AccessOption`, `Role`, `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug`.
|
||||
Types: `AccessOption`, `Role`, `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug`.
|
||||
|
||||
## Account rules (`accounts`)
|
||||
|
||||
Rules for the accounts of the staff collection. All on by default; each has its own switch, and
|
||||
`ipalKit({ accounts: false })` turns them all off.
|
||||
`iapl({ accounts: false })` turns them all off.
|
||||
|
||||
```ts
|
||||
ipalKit({
|
||||
iapl({
|
||||
access: { authCollection: 'users' },
|
||||
// accounts: { panelRole: 'user' }, // every account may open the panel (as before)
|
||||
// accounts: { adminOnlyCreate: false }, // Payload's default `create` on your own staff collection
|
||||
@@ -251,7 +251,7 @@ account that holds only `user` (or no role) logs in and sees Payload's "Unauthor
|
||||
touched** — such an account still gets over REST / GraphQL what its role allows. The rule looks at the role, not
|
||||
at the second factor, so the 2FA screens stay reachable.
|
||||
|
||||
- **What an existing site sees on the first start:** the log line `[ipal] N account(s) of "users" are below the
|
||||
- **What an existing site sees on the first start:** the log line `[iapl] N account(s) of "users" are below the
|
||||
role "editor" and cannot open the admin panel` — give those people `editor`, or set `panelRole: 'user'`. When
|
||||
**no** account has the role it is an error (`NOBODY can open the admin panel`): give one account the role with
|
||||
a script (`payload.update`, Local API) or set `accounts: { panelRole: false }` and redeploy.
|
||||
@@ -324,11 +324,11 @@ declared values, not your code: a value that a hook of yours puts into `roles` (
|
||||
`['admin']` from a checkbox, a virtual field) is not seen — such a collection is judged by its declared field.
|
||||
|
||||
**If no staff account holds `admin` at all**, nobody can create, delete or unlock accounts in such a collection.
|
||||
The start log says so: `[ipal] No staff account holds the role "admin", so NOBODY can create, delete or unlock
|
||||
The start log says so: `[iapl] No staff account holds the role "admin", so NOBODY can create, delete or unlock
|
||||
accounts in "…"`. Way out: give one account the role with a script (`payload.update`, Local API), or write the
|
||||
collection's own rules. The check asks each staff collection in the way its field allows (a count for a select,
|
||||
reading the accounts for text / json / relationship fields, up to 1000 of them); where it cannot check a
|
||||
collection it says `[ipal] Could not check whether an account of "…" holds the role "admin"` instead and claims
|
||||
collection it says `[iapl] Could not check whether an account of "…" holds the role "admin"` instead and claims
|
||||
nothing.
|
||||
|
||||
**Roles of your own — what the plugin does and does not hold.** It cannot rank `superadmin` against `writer`,
|
||||
@@ -336,16 +336,16 @@ so inside such a collection it enforces one thing only: an account does not chan
|
||||
else that was allowed inside the collection stays allowed — **every account of it may still create an account
|
||||
with any role, and change or delete another account**. That is a hole only you can close: write the
|
||||
collection's `create` / `update` / `delete` rules and the field access of its `roles` field from your roles.
|
||||
`ipal-doctor --url` names such a collection (`staff-own-roles`, warning). What the plugin closes for you is the
|
||||
`iapl-doctor --url` names such a collection (`staff-own-roles`, warning). What the plugin closes for you is the
|
||||
door for accounts of **other** collections.
|
||||
|
||||
**A staff collection without a `roles` field:** every account of it is an admin to the plugin (unchanged), so
|
||||
it may also manage the accounts of the other staff collections. Give it the plugin's roles
|
||||
(`buildRolesField`), or write its rules.
|
||||
|
||||
**A staff collection that a plugin listed after ipalKit adds** gets the same rules, the password rule and the
|
||||
**A staff collection that a plugin listed after iapl adds** gets the same rules, the password rule and the
|
||||
first-user endpoint when the config goes live — at start and on every dev reload. The log says exactly what was
|
||||
put: `[ipal] "late-staff" was added after ipalKit: put on it — access rules for create, update, delete, unlock,
|
||||
put: `[iapl] "late-staff" was added after iapl: put on it — access rules for create, update, delete, unlock,
|
||||
read, readVersions, roles; the password rule; the first-user endpoint.` One difference from a collection of your
|
||||
own config: by then Payload has sanitized the collection and filled every missing rule with its default, and
|
||||
that default cannot be told from a rule somebody wrote (a production build renames every function). So the
|
||||
@@ -353,18 +353,18 @@ plugin does not guess: **its rule is put in front of whatever rule is there, and
|
||||
(`bothAllow`). With Payload's default behind it the result is the plugin's rule; a rule of the collection's own
|
||||
is kept and can only narrow it. To keep a late collection's rules exactly as they are — an open `create`, a
|
||||
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.
|
||||
first-user endpoint still apply), or list that plugin before iapl.
|
||||
|
||||
**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:
|
||||
and a plugin listed after iapl 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
|
||||
is the one in force. The log: `[iapl] "people" became a staff collection after iapl 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
|
||||
`access.staffCollections`, or list that plugin before iapl. Verify: sign in as an account of a non-staff
|
||||
collection and `POST /api/<slug>` — 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' }`),
|
||||
@@ -433,7 +433,7 @@ container serving, so a wrong slug never goes live (`unknownStaffCollections`).
|
||||
- **What an existing site sees:** nothing, unless its own staff collection relied on Payload's defaults
|
||||
(non-admins creating accounts in a collection with the plugin's roles; accounts of another collection writing
|
||||
to it) — then write the rule you want, or set `adminOnlyCreate: false` / `adminOnlyWrite: false`.
|
||||
- `ipal-doctor --url`: `open-signup` (info) lists auth collections with open sign-up; `staff-own-roles` (warning)
|
||||
- `iapl-doctor --url`: `open-signup` (info) lists auth collections with open sign-up; `staff-own-roles` (warning)
|
||||
a staff collection with role values of its own on the default rules; `staff-accounts-open`
|
||||
(error) names a staff collection an account of another collection may create in, read (a warning), update, delete from or unlock
|
||||
(the rules are off, or your own rule is wider).
|
||||
|
||||
Reference in New Issue
Block a user