1.17.2 (owner's Q1-Q3): form submissions over REST for staff only; Payload's job queue for an admin or Bearer CRON_SECRET; doctor visitor-writes; explicit write rules on the reference site

- form-submissions create: a staff account with its second factor (formSubmissionOverrides.access.create keeps the way back)
- jobsRunAccess (default on when the project writes no jobs.access.run): admin with the second factor or Bearer CRON_SECRET (16+); start-up note when the secret is missing; jobsRunAccess: false keeps Payload's default
- iapl-doctor deep rule visitor-writes: entities a visitor login account may write, asked by behaviour
- reference: Pages, Posts, CaseStudies, Media, Header, Footer, Company get adminOrEditor write rules
- closed doors: submissions, pages, media, header, company closed for customers; the fixture's job queue refused without the secret, run with it
- route snapshot reasons, docs, AGENT.md, skills, changelog draft 1.17.2

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 10:44:18 +01:00
co-authored by Claude Opus 5.5
parent fc70a34f3e
commit 4e68b7e44a
40 changed files with 657 additions and 187 deletions
+24
View File
@@ -159,6 +159,30 @@ describe('forms collection: public read, editor+ write, Emails hidden from plain
})
})
describe('form submissions over REST / GraphQL: staff only (1.17.2)', () => {
const build = async (forms: object = {}) => {
const config = await iapl({ access: { authCollection: 'users' }, forms, i18n, twoFactor: false })(
empty({ collections: [{ slug: 'customers', auth: true, fields: [] }] }),
)
return config.collections?.find((c) => c.slug === 'form-submissions') as CollectionConfig
}
// the staff check reads the panel's collection from the request's Payload, as in a request
const runAs = (fn: Access | undefined, u: unknown) =>
(fn as Access)({ req: { payload: { config: { admin: { user: 'users' } } }, user: u } } as never)
test('a customer account, or nobody, cannot create a submission; any staff role can', async () => {
const { access = {} } = await build()
expect(runAs(access.create, null)).toBe(false)
expect(runAs(access.create, { id: 9, collection: 'customers' })).toBe(false)
for (const staff of [user, editor, admin]) {expect(runAs(access.create, staff)).toBe(true)}
})
test('formSubmissionOverrides.access.create is the way back', async () => {
const { access = {} } = await build({ formSubmissionOverrides: { access: { create: () => true } } })
expect(runAs(access.create, { id: 9, collection: 'customers' })).toBe(true)
})
})
describe('roles field: the first-register account becomes admin', () => {
const hook = async (totalDocs: number, value: string[], pathname = '/api/users/first-register') => {
const config = await iapl({ access: { authCollection: 'users' }, i18n, twoFactor: false })(empty())