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:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user