fix: enable overrideAccess=true for public Payload repository reads

All public pages (site settings, header, pages, articles) now bypass
Payload's access control checks when reading, as they should be publicly
accessible without authentication. This fixes 403 Forbidden errors on
homepage and article rendering.
This commit is contained in:
2026-05-05 08:59:18 +02:00
parent 7809f21151
commit 1308fe4644
7 changed files with 12 additions and 10 deletions

View File

@@ -68,7 +68,7 @@ export class PayloadPagesRepository implements IPagesRepository {
collection: "pages",
where: { slug: { equals: slug } },
limit: 1,
overrideAccess: false,
overrideAccess: true,
});
const doc = result.docs[0] as PayloadPageDoc | undefined;
return doc ? mapDoc(doc) : undefined;
@@ -89,7 +89,7 @@ export class PayloadPagesRepository implements IPagesRepository {
page: options?.offset
? Math.floor(options.offset / (options.limit ?? 50)) + 1
: 1,
overrideAccess: false,
overrideAccess: true,
});
return result.docs.map((d) => mapDoc(d as PayloadPageDoc));
}

View File

@@ -23,7 +23,7 @@ export class PayloadSiteSettingsRepository implements ISiteSettingsRepository {
const payload = await getPayload({ config: this.config });
const doc = (await payload.findGlobal({
slug: "site-settings",
overrideAccess: false,
overrideAccess: true,
})) as PayloadSiteSettings;
return {
siteName: doc.siteName ?? "My App",