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
@@ -5,7 +5,7 @@ import { fields as builtinBlocks, formBuilderPlugin } from '@payloadcms/plugin-f
|
||||
|
||||
import type { FormsOption } from './types.js'
|
||||
|
||||
import { hasMinimumRole, isAdmin } from '../access/predicates.js'
|
||||
import { userMeetsRole } from '../access/predicates.js'
|
||||
import { checkboxGroupBlock, stepBlock, timeBlock, withPlaceholder, withShowWhen } from './builderBlocks.js'
|
||||
import { buildEmailLayoutHook } from './emailLayout.js'
|
||||
|
||||
@@ -24,13 +24,13 @@ const submissionsCreateAccess = ({ req }: AccessArgs) => Boolean(req.user)
|
||||
* form-builder default lets ANY account of the admin collection read them —
|
||||
* including a plain 'user' from an open sign-up.
|
||||
*/
|
||||
const submissionsReadAccess = ({ req }: AccessArgs) => hasMinimumRole(req.user as never, 'editor')
|
||||
const submissionsDeleteAccess = ({ req }: AccessArgs) => isAdmin(req.user as never)
|
||||
const submissionsReadAccess = ({ req }: AccessArgs) => userMeetsRole(req, 'editor')
|
||||
const submissionsDeleteAccess = ({ req }: AccessArgs) => userMeetsRole(req, 'admin')
|
||||
/**
|
||||
* Forms carry recipient addresses (Emails → To/BCC): a plain 'user' account
|
||||
* editing a form could BCC every submission to itself. Editors and admins only.
|
||||
*/
|
||||
const staffAccess = ({ req }: AccessArgs) => hasMinimumRole(req.user as never, 'editor')
|
||||
const staffAccess = ({ req }: AccessArgs) => userMeetsRole(req, 'editor')
|
||||
|
||||
/**
|
||||
* Forms stay publicly readable (their fields render the form), but the Emails
|
||||
|
||||
Reference in New Issue
Block a user