- 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]>
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import {
|
|
adminOrEditor,
|
|
buildNoindexField,
|
|
buildPreventDeleteSystemPage,
|
|
buildRevalidateHook,
|
|
buildSlugField,
|
|
buildSummaryField,
|
|
rowLabel,
|
|
trackSlugHistoryHook,
|
|
} from '@intecion/ipal-kit'
|
|
import { revalidatePath } from 'next/cache'
|
|
|
|
import { pageBlocks } from '@/blocks/configs'
|
|
import { i18nConfig } from '@/i18n.config'
|
|
|
|
const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
|
|
|
|
export const Pages: CollectionConfig = {
|
|
slug: 'pages',
|
|
admin: { defaultColumns: ['title', 'slug', 'updatedAt'], useAsTitle: 'title' },
|
|
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
|
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
|
|
fields: [
|
|
{ name: 'title', type: 'text', localized: true, required: true },
|
|
buildSlugField({ from: 'title' }),
|
|
{ name: 'layout', type: 'blocks', blocks: pageBlocks, minRows: 1 },
|
|
buildSummaryField(), // aiSummary — GEO (llms.txt, MCP)
|
|
buildNoindexField(),
|
|
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text' }], labels: { plural: 'Old addresses', singular: 'Old address' } },
|
|
],
|
|
hooks: {
|
|
afterChange: [revalidate.afterChange],
|
|
afterDelete: [revalidate.afterDelete],
|
|
beforeChange: [trackSlugHistoryHook],
|
|
beforeDelete: [buildPreventDeleteSystemPage({ settingsSlug: 'site-settings' })],
|
|
},
|
|
}
|