mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
Sorted all imports in all packages, `cms`, `design-system` and `ui-library` apps by running `pnpm format` on them. All changes in this PR are done by the script.
16 lines
537 B
TypeScript
16 lines
537 B
TypeScript
import type { AccessArgs, FieldAccess } from 'payload'
|
|
|
|
import type { User } from '../payload-types'
|
|
|
|
type isAdmin = (args: AccessArgs<User>) => boolean
|
|
|
|
export const isAdmin: isAdmin = ({ req: { user } }) => {
|
|
// Return true or false based on if the user has an admin role
|
|
return Boolean(user?.roles?.includes('admin'))
|
|
}
|
|
|
|
export const isAdminFieldLevel: FieldAccess<{ id: string }, User> = ({ req: { user } }) => {
|
|
// Return true or false based on if the user has an admin role
|
|
return Boolean(user?.roles?.includes('admin'))
|
|
}
|