fix: permissions and views

This commit is contained in:
Benno Tielen 2026-03-09 11:49:13 +01:00
parent a190e0aa6d
commit 3a5b982bf7
7 changed files with 16 additions and 5 deletions

View file

@ -1,5 +1,5 @@
import { CollectionConfig } from 'payload' import { CollectionConfig } from 'payload'
import { isAdminOrEmployee } from '@/collections/access/admin' import { hide, isAdminOrEmployee } from '@/collections/access/admin'
export const DonationForms: CollectionConfig = { export const DonationForms: CollectionConfig = {
slug: 'donation-form', slug: 'donation-form',
@ -35,6 +35,9 @@ export const DonationForms: CollectionConfig = {
required: true required: true
} }
], ],
admin: {
hidden: hide
},
access: { access: {
read: () => true, read: () => true,
create: isAdminOrEmployee(), create: isAdminOrEmployee(),

View file

@ -1,5 +1,5 @@
import { CollectionConfig } from 'payload' import { CollectionConfig } from 'payload'
import { isAdminOrEmployee } from '@/collections/access/admin' import { hide, isAdminOrEmployee } from '@/collections/access/admin'
export const Magazine: CollectionConfig = { export const Magazine: CollectionConfig = {
slug: 'magazine', slug: 'magazine',
@ -39,6 +39,9 @@ export const Magazine: CollectionConfig = {
required: true required: true
} }
], ],
admin: {
hidden: hide
},
access: { access: {
read: () => true, read: () => true,
update: isAdminOrEmployee(), update: isAdminOrEmployee(),

View file

@ -1,6 +1,6 @@
import { CollectionConfig } from 'payload' import { CollectionConfig } from 'payload'
import { revalidateTag } from 'next/cache' import { revalidateTag } from 'next/cache'
import { isAdminOrEmployee } from '@/collections/access/admin' import { hide, isAdminOrEmployee } from '@/collections/access/admin'
export const Prayers: CollectionConfig = { export const Prayers: CollectionConfig = {
slug: 'prayers', slug: 'prayers',
@ -24,6 +24,7 @@ export const Prayers: CollectionConfig = {
], ],
admin: { admin: {
useAsTitle: 'text', useAsTitle: 'text',
hidden: hide
}, },
access: { access: {
read: () => true, read: () => true,

View file

@ -17,6 +17,7 @@ export const DesignGlobal: GlobalConfig = {
admin: { admin: {
description: description:
'Hier können Sie die Farben und das Erscheinungsbild der Website konfigurieren.', 'Hier können Sie die Farben und das Erscheinungsbild der Website konfigurieren.',
hidden: args => args.user?.roles === "user"
}, },
fields: [ fields: [
{ {

View file

@ -10,6 +10,7 @@ export const FooterGlobal: GlobalConfig = {
admin: { admin: {
description: description:
'Hier können Sie die Linkgruppen im Fußzeile konfigurieren.', 'Hier können Sie die Linkgruppen im Fußzeile konfigurieren.',
hidden: args => args.user?.roles === "user"
}, },
fields: [ fields: [
{ {

View file

@ -1,5 +1,5 @@
import { Block, GlobalConfig } from 'payload' import { Block, GlobalConfig } from 'payload'
import { isAdmin } from '@/collections/access/admin' import { hide, isAdmin } from '@/collections/access/admin'
import { revalidateTag } from 'next/cache' import { revalidateTag } from 'next/cache'
const SimpleItem: Block = { const SimpleItem: Block = {
@ -111,7 +111,8 @@ export const MenuGlobal: GlobalConfig = {
de: 'Navigationsmenü' de: 'Navigationsmenü'
}, },
admin: { admin: {
description: "Hier können Sie die Einträge und die Reihenfolge der Hauptnavigation festlegen." description: "Hier können Sie die Einträge und die Reihenfolge der Hauptnavigation festlegen.",
hidden: args => args.user?.roles === "user"
}, },
fields: [ fields: [
{ {

View file

@ -10,6 +10,7 @@ export const SiteConfigGlobal: GlobalConfig = {
admin: { admin: {
description: description:
'Hier können Sie den Namen, die Beschreibung und andere allgemeine Einstellungen der Website konfigurieren.', 'Hier können Sie den Namen, die Beschreibung und andere allgemeine Einstellungen der Website konfigurieren.',
hidden: args => args.user?.roles === "user"
}, },
fields: [ fields: [
{ {