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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import { Block, GlobalConfig } from 'payload'
import { isAdmin } from '@/collections/access/admin'
import { hide, isAdmin } from '@/collections/access/admin'
import { revalidateTag } from 'next/cache'
const SimpleItem: Block = {
@ -111,7 +111,8 @@ export const MenuGlobal: GlobalConfig = {
de: 'Navigationsmenü'
},
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: [
{

View file

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