fix(plugin-form-builder)!: emails array field has read access by authenticated users only by default now (#8338)
This commit is contained in:
@@ -154,6 +154,10 @@ Override anything on the `forms` collection by sending a [Payload Collection Con
|
|||||||
|
|
||||||
Note that the `fields` property is a function that receives the default fields and returns an array of fields. This is because the `fields` property is a special case that is merged with the default fields, rather than replacing them. This allows you to map over default fields and modify them as needed.
|
Note that the `fields` property is a function that receives the default fields and returns an array of fields. This is because the `fields` property is a special case that is merged with the default fields, rather than replacing them. This allows you to map over default fields and modify them as needed.
|
||||||
|
|
||||||
|
<Banner type="warning">
|
||||||
|
Good to know: The form collection is publicly available to read by default. The emails field is locked for authenticated users only. If you have any frontend users you should override the access permissions for both the collection and the emails field to make sure you don't leak out any private emails.
|
||||||
|
</Banner>
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
// payload.config.ts
|
// payload.config.ts
|
||||||
formBuilder({
|
formBuilder({
|
||||||
@@ -161,7 +165,7 @@ formBuilder({
|
|||||||
formOverrides: {
|
formOverrides: {
|
||||||
slug: 'contact-forms',
|
slug: 'contact-forms',
|
||||||
access: {
|
access: {
|
||||||
read: () => true,
|
read: ({ req: { user } }) => !!user, // authenticated users only
|
||||||
update: () => false,
|
update: () => false,
|
||||||
},
|
},
|
||||||
fields: ({ defaultFields }) => {
|
fields: ({ defaultFields }) => {
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ export const generateFormCollection = (formConfig: FormBuilderPluginConfig): Col
|
|||||||
{
|
{
|
||||||
name: 'emails',
|
name: 'emails',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
access: {
|
||||||
|
read: ({ req: { user } }) => !!user,
|
||||||
|
},
|
||||||
admin: {
|
admin: {
|
||||||
description:
|
description:
|
||||||
"Send custom emails when the form submits. Use comma separated lists to send the same email to multiple recipients. To reference a value from this form, wrap that field's name with double curly brackets, i.e. {{firstName}}. You can use a wildcard {{*}} to output all data and {{*:table}} to format it as an HTML table in the email.",
|
"Send custom emails when the form submits. Use comma separated lists to send the same email to multiple recipients. To reference a value from this form, wrap that field's name with double curly brackets, i.e. {{firstName}}. You can use a wildcard {{*}} to output all data and {{*:table}} to format it as an HTML table in the email.",
|
||||||
|
|||||||
Reference in New Issue
Block a user