fix: Access function types
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
tobias 2024-06-23 11:14:52 +02:00
parent 2cfca5e7cf
commit e63dd42b6c
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import { Access, FieldAccess } from 'payload/types'
import { Access } from 'payload/types'
import type { User } from 'types/payload-types'
export const isAdmin = ({ req: { user } }) => {
export const isAdmin = ({ req: { user } }: any) => {
if (user && user.roles?.includes('admin')) {
return true
}
@ -9,7 +9,7 @@ export const isAdmin = ({ req: { user } }) => {
return false
}
export const isAdminOrCreatedBy = ({ req: { user } }) => {
export const isAdminOrCreatedBy = ({ req: { user } }: any) => {
if (user && user.role === 'admin') {
return true
}
@ -25,7 +25,7 @@ export const isAdminOrCreatedBy = ({ req: { user } }) => {
return false
}
export const isAdminOrSelf = ({ req: { user } }) => {
export const isAdminOrSelf = ({ req: { user } }: any) => {
if (user) {
if (user.roles?.includes('admin')) {
return true

View File

@ -1,7 +1,7 @@
import { Access, FieldAccess } from 'payload/types'
import type { User } from 'types/payload-types'
export const isEditor = ({ req: { user } }) => {
export const isEditor = ({ req: { user } }: any) => {
if (user?.roles?.some((role) => ['editor', 'admin'].includes(role))) {
return true
}

View File

@ -1,8 +1,8 @@
import { Access, FieldAccess } from 'payload/types'
import type { User } from 'types/payload-types'
export const isUser = ({ req: { user } }) => {
if (user?.roles?.some((role) => ['user', 'editor', 'admin'].includes(role))) {
export const isUser = ({ req: { user } }: any) => {
if (user && user?.roles?.some((role: string) => ['user', 'editor', 'admin'].includes(role))) {
return true
}