mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-16 11:33:07 +00:00
The four public globals (site-settings, home, metadata, privacy-policy) spelled update access as "any authenticated user" — and campaign JWTs authenticate against /api/*, so any campaign session (leader included) could PATCH the public site. payloadAdminOnly matches the collection lockdown precedent; editors lose config-global writes deliberately (content editing stays on canManagePublishedContent collections). Pins: identity + deny (coordinator/editor) + allow (admin fn) + anonymous read in collectionAccessLockdown.int.spec.ts. Recurrence guard: globalAccessConventions.unit.spec.ts bans the Boolean(user) shape in src/globals. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
32 lines
696 B
TypeScript
32 lines
696 B
TypeScript
import { payloadAdminOnly } from '@/utilities/campaignAccess'
|
|
import { revalidateGlobal } from '@/utilities/globals'
|
|
import { GlobalConfig } from 'payload'
|
|
|
|
const slug = 'home'
|
|
|
|
const revalidate = async () => revalidateGlobal(slug)
|
|
|
|
export const HomePage: GlobalConfig = {
|
|
slug,
|
|
label: 'Pagina Inicial',
|
|
admin: {
|
|
group: 'Paginas',
|
|
},
|
|
access: {
|
|
read: () => true,
|
|
// Admin-only like the other site globals (Pass 4) — campaign JWTs reach /api/*.
|
|
update: payloadAdminOnly,
|
|
},
|
|
hooks: {
|
|
afterChange: [revalidate],
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'image',
|
|
type: 'upload',
|
|
label: 'Imagem',
|
|
relationTo: 'media',
|
|
required: true,
|
|
},
|
|
],
|
|
}
|