Small fixes: optional R2_PUBLIC_URL, seo.uploadsCollection, staff features without roles
- ipalEnvRules({ storage: true }): R2_PUBLIC_URL optional (media served by
the app); storage: { requirePublicUrl: true } requires it again.
- seo.uploadsCollection: upload collection of the meta image (default media).
- userMeetsRole(req, minimum): the plugin's admin/editor features (Site
Integrations, settings globals, test e-mail, stats, consent records, form
submissions) stay reachable when `access` is omitted — without a roles
field every logged-in account passes, as in Payload's default.
- IndexNow skip for seed writes is covered by test/seed.test.ts.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cff76c2a69
commit
4911da7112
@@ -1,6 +1,6 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
import { adminOrEditor } from '../../modules/access/index.js'
|
||||
import { userMeetsRole } from '../../modules/access/index.js'
|
||||
import { cookieSettingsFields } from './fields.js'
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ export function buildCookieSettings(): GlobalConfig {
|
||||
slug: 'cookie-settings',
|
||||
access: {
|
||||
read: () => true,
|
||||
update: adminOrEditor, // consent texts are legal copy — not for plain 'user' accounts
|
||||
update: ({ req }) => userMeetsRole(req, 'editor'), // consent texts are legal copy — not for plain 'user' accounts
|
||||
},
|
||||
admin: {
|
||||
group: 'Settings',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
import { adminOrEditor } from '../../modules/access/index.js'
|
||||
import { userMeetsRole } from '../../modules/access/index.js'
|
||||
import { notificationsFields } from './fields.js'
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ export function buildNotifications(): GlobalConfig {
|
||||
slug: 'notifications',
|
||||
access: {
|
||||
read: () => true, // texts are public-facing (shown to end users)
|
||||
update: adminOrEditor,
|
||||
update: ({ req }) => userMeetsRole(req, 'editor'),
|
||||
},
|
||||
admin: { group: 'Settings' },
|
||||
fields: notificationsFields,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Field, GlobalConfig } from 'payload'
|
||||
|
||||
import { isAdmin } from '../../modules/access/index.js'
|
||||
import { userMeetsRole } from '../../modules/access/index.js'
|
||||
import { indexNowFields } from '../../modules/seo/indexNow.js'
|
||||
import { analyticsFields } from './fields/analytics.js'
|
||||
import { smtpFields } from './fields/smtp.js'
|
||||
@@ -31,8 +31,9 @@ export function buildSiteIntegrations({
|
||||
access: {
|
||||
// Admin-only — secrets live here. Anonymous and non-admin users get
|
||||
// nothing through the API; admins read/edit in the panel and via Local API.
|
||||
read: ({ req: { user } }) => isAdmin(user),
|
||||
update: ({ req: { user } }) => isAdmin(user),
|
||||
// Without roles (no `access` option) every logged-in account is admin.
|
||||
read: ({ req }) => userMeetsRole(req, 'admin'),
|
||||
update: ({ req }) => userMeetsRole(req, 'admin'),
|
||||
},
|
||||
admin: {
|
||||
group: 'Settings',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Field, GlobalConfig } from 'payload'
|
||||
|
||||
import { adminOrEditor } from '../../modules/access/index.js'
|
||||
import { userMeetsRole } from '../../modules/access/index.js'
|
||||
import { generalFields } from './fields/general.js'
|
||||
import { themeFields } from './fields/theme.js'
|
||||
|
||||
@@ -48,7 +48,7 @@ export function buildSiteSettings({
|
||||
read: () => true,
|
||||
// Editors and admins only — a plain 'user' account (open sign-up) must
|
||||
// not rewrite the brand, homepage or construction mode.
|
||||
update: adminOrEditor,
|
||||
update: ({ req }) => userMeetsRole(req, 'editor'),
|
||||
},
|
||||
admin: {
|
||||
group: 'Settings',
|
||||
|
||||
Reference in New Issue
Block a user