Copied staff collections: access guide, API table, changelog, reference index
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
8dcc123b99
commit
c9540d291a
@@ -1164,8 +1164,8 @@ Rules: AGENT.md §8a.
|
||||
|---|---|
|
||||
| `e2e/create-test-admin.ts` | two test admins with a known TOTP secret (the specs share out the five 2FA verify attempts per account), their stored verify counts cleared, and e-mail sending pointed at the tests' mail sink (local / CI database only) |
|
||||
| `e2e/global-setup.ts` | Playwright global setup: resets the test admins and clears their stored 2FA attempt counts before every run, so specs do not depend on run order (below) |
|
||||
| `e2e/late-staff-fixture.ts` | test fixture, on only with E2E_LATE_STAFF=1: one plugin before ipalKit (a staff collection of the config whose roles are the plugin's values plus one more) and one after it (a staff collection without rules, one whose roles field is text, a visitor collection with open sign-up) (below) |
|
||||
| `e2e/late-staff.spec.ts` | the account rules on a BUILT site (run by `pnpm e2e:built` after a webpack and a Turbopack build): a staff collection a later plugin adds, and staff collections whose accounts can hold `admin` — a visitor account gets nothing, nobody raises its own role or makes an admin |
|
||||
| `e2e/late-staff-fixture.ts` | test fixture, on only with E2E_LATE_STAFF=1: one plugin before ipalKit (staff collections of the config: roles with one more value, the plugin's roles, roles of the project's own) and one after it (a staff collection without rules, one whose roles field is text, copies of staff collections under new slugs — plain, with rules of their own, one rule used for another operation, other role values, the opt-out, not staff — and a visitor collection with open sign-up) |
|
||||
| `e2e/late-staff.spec.ts` | the account rules on a BUILT site (run by `pnpm e2e:built` after a webpack and a Turbopack build): a staff collection a later plugin adds, staff collections whose accounts can hold `admin`, and copies of staff collections — a visitor account gets nothing, nobody raises its own role or makes an admin, a copy is never wider than the plugin's rule |
|
||||
| `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms (also a file sent by e-mail), sitemap, SEO/GEO, headers, consent, 2FA |
|
||||
| `e2e/smtp-sink.ts` | a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments) |
|
||||
| `e2e/totp.ts` | RFC 6238 code generator for the 2FA sign-in in the smoke test, and the address of the second test admin (below) |
|
||||
@@ -1191,48 +1191,6 @@ export default function globalSetup(): void {
|
||||
}
|
||||
```
|
||||
|
||||
### `e2e/late-staff-fixture.ts`
|
||||
|
||||
```ts
|
||||
import type { Config, Plugin } from 'payload'
|
||||
|
||||
/**
|
||||
* Test fixture, on only with E2E_LATE_STAFF=1 (e2e/late-staff.spec.ts): a plugin listed AFTER ipalKit that adds
|
||||
* a staff collection (`late-staff`, named in `access.staffCollections`) and a visitor collection with open
|
||||
* sign-up. ipalKit has already run when these collections appear, so it must give them its account rules when
|
||||
* the config goes live — and it must do so in a BUILT site too, where bundlers rename every function.
|
||||
* Never part of a real site: the starter drops `e2e/` and the lines that use this file.
|
||||
*/
|
||||
export const E2E_LATE_STAFF = process.env.E2E_LATE_STAFF === '1'
|
||||
|
||||
/** Slugs the fixture names as staff (payload.config.ts → `access.staffCollections`). */
|
||||
export const E2E_STAFF_SLUGS = ['late-staff', 'e2e-crew', 'e2e-late-text']
|
||||
|
||||
/**
|
||||
* Listed BEFORE ipalKit: a staff collection of the project's own, without rules, whose roles are the plugin's values
|
||||
* PLUS one more. `admin` on an account of it makes a plugin admin, so its accounts must not hand that value out.
|
||||
*/
|
||||
export const e2eEarlyStaff: Plugin = (config: Config) =>
|
||||
E2E_LATE_STAFF
|
||||
? { ...config, collections: [...(config.collections ?? []), { slug: 'e2e-crew', auth: true, fields: [{ name: 'roles', type: 'select', hasMany: true, options: ['user', 'editor', 'admin', 'boss'], saveToJWT: true }] }] }
|
||||
: config
|
||||
|
||||
export const e2eLateStaff: Plugin = (config: Config) =>
|
||||
E2E_LATE_STAFF
|
||||
? {
|
||||
...config,
|
||||
collections: [
|
||||
...(config.collections ?? []),
|
||||
// no access rules at all: Payload's defaults ("any logged-in user") are what ipalKit must replace
|
||||
{ slug: 'late-staff', auth: true, fields: [{ name: 'roles', type: 'select', hasMany: true, options: ['user', 'editor', 'admin'], saveToJWT: true }], versions: true },
|
||||
// a late staff collection whose `roles` is a text field: any value can be written there, `admin` included
|
||||
{ slug: 'e2e-late-text', auth: true, fields: [{ name: 'roles', type: 'text', hasMany: true }] },
|
||||
{ slug: 'e2e-visitors', access: { create: () => true }, auth: true, fields: [] },
|
||||
],
|
||||
}
|
||||
: config
|
||||
```
|
||||
|
||||
### `e2e/totp.ts`
|
||||
|
||||
```ts
|
||||
|
||||
Reference in New Issue
Block a user