This commit is contained in:
parent
2cfca5e7cf
commit
e63dd42b6c
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user