diff --git a/src/globals/SEOSettings.ts b/src/globals/SEOSettings.ts index 5cccb6e..5a048cd 100644 --- a/src/globals/SEOSettings.ts +++ b/src/globals/SEOSettings.ts @@ -17,18 +17,11 @@ export const SEOSettings: GlobalConfig = { description: 'Globale SEO-Konfiguration und Schema.org Daten', }, access: { - // Alle angemeldeten Benutzer können lesen - read: ({ req: { user } }) => { - const result = Boolean(user) - if (!result) console.log('[DEBUG:SEO] read ACCESS DENIED - no user') - return result - }, + // Öffentlich lesbar - SEO-Daten sind nicht sensitiv und werden + // beim Admin-Panel SSR benötigt (wo der User-Kontext fehlen kann) + read: () => true, // Nur Super Admins können bearbeiten - update: ({ req: { user } }) => { - const result = Boolean(user?.isSuperAdmin) - console.log('[DEBUG:SEO] update access:', { email: user?.email, isSuperAdmin: user?.isSuperAdmin, result }) - return result - }, + update: ({ req: { user } }) => Boolean(user?.isSuperAdmin), }, fields: [ // === META DEFAULTS === diff --git a/src/payload.config.ts b/src/payload.config.ts index 1e82cde..cf2d1af 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -131,37 +131,6 @@ const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) export default buildConfig({ - // DEBUG: Log all API requests that result in 403 - onInit: async (payload) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const origFindGlobal = payload.findGlobal.bind(payload) as any - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ;(payload as any).findGlobal = async (args: any) => { - try { return await origFindGlobal(args) } catch (err: any) { - if (err?.status === 403) console.log('[DEBUG:403] Global read FORBIDDEN:', { slug: args.slug, user: args.req?.user?.email || 'no user' }) - throw err - } - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const origUpdate = payload.update.bind(payload) as any - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ;(payload as any).update = async (args: any) => { - try { return await origUpdate(args) } catch (err: any) { - if (err?.status === 403) console.log('[DEBUG:403] Collection update FORBIDDEN:', { collection: args.collection, id: args.id, user: args.req?.user?.email || 'no user' }) - throw err - } - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const origUpdateGlobal = payload.updateGlobal.bind(payload) as any - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ;(payload as any).updateGlobal = async (args: any) => { - try { return await origUpdateGlobal(args) } catch (err: any) { - if (err?.status === 403) console.log('[DEBUG:403] Global update FORBIDDEN:', { slug: args.slug, user: args.req?.user?.email || 'no user' }) - throw err - } - } - console.log('[DEBUG] 403 interceptors installed') - }, serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL || 'https://pl.porwoll.tech', admin: { user: Users.slug,