From 519df326cec7cca3a9defa9017b1027bc9b57a87 Mon Sep 17 00:00:00 2001 From: tobias Date: Sat, 6 Jul 2024 19:11:38 +0200 Subject: [PATCH] Temporarily turn off access controls --- src/app/(payload)/access/isAdmin.ts | 4 ++++ src/app/(payload)/access/isEditor.ts | 1 + src/app/(payload)/access/isUser.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/src/app/(payload)/access/isAdmin.ts b/src/app/(payload)/access/isAdmin.ts index d649515..7a7020d 100644 --- a/src/app/(payload)/access/isAdmin.ts +++ b/src/app/(payload)/access/isAdmin.ts @@ -2,6 +2,7 @@ import { Access } from 'payload/types' import type { User } from 'types/payload-types' export const isAdmin = ({ req: { user } }: any) => { + return true if (!user.roles) { return false } @@ -14,6 +15,7 @@ export const isAdmin = ({ req: { user } }: any) => { } export const isAdminOrCreatedBy = ({ req: { user } }: any) => { + return true if (user.role) { return false } @@ -34,6 +36,7 @@ export const isAdminOrCreatedBy = ({ req: { user } }: any) => { } export const isAdminOrSelf = ({ req: { user } }: any) => { + return true if (user) { if (!user.roles) { return false @@ -54,6 +57,7 @@ export const isAdminOrSelf = ({ req: { user } }: any) => { } export const isAdminOrPublished = ({ req: { user } }: any) => { + return true if (user && user?.role === 'admin') { return true } diff --git a/src/app/(payload)/access/isEditor.ts b/src/app/(payload)/access/isEditor.ts index e25dbe5..50b4bfb 100644 --- a/src/app/(payload)/access/isEditor.ts +++ b/src/app/(payload)/access/isEditor.ts @@ -2,6 +2,7 @@ import { Access, FieldAccess } from 'payload/types' import type { User } from 'types/payload-types' export const isEditor = ({ req: { user } }: any) => { + return true if (!user.roles) { return false } diff --git a/src/app/(payload)/access/isUser.ts b/src/app/(payload)/access/isUser.ts index 5b9fdde..fc5b6f9 100644 --- a/src/app/(payload)/access/isUser.ts +++ b/src/app/(payload)/access/isUser.ts @@ -2,6 +2,7 @@ import { Access, FieldAccess } from 'payload/types' import type { User } from 'types/payload-types' export const isUser = ({ req: { user } }: any) => { + return true if (!user.roles) { return false }