Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Globals Access Control

You can define Global-level Access Control within each Global's access property. All Access Control functions accept one args argument.

\\Available argument properties:

Available Controls

Function

Allows/Denies Access

read

Used in the findOne Global operation

update

Used in the update Global operation

Example Global config:

1
import { GlobalConfig } from 'payload/types'
2
3
const Header: GlobalConfig = {
4
slug: 'header',
5
access: {
6
read: ({ req: { user } }) => {
7
/* */
8
},
9
update: ({ req: { user } }) => {
10
/* */
11
},
12
},
13
}
14
15
export default Header

Read

Returns a boolean result or optionally a query constraint which limits who can read this global based on its current properties.

Available argument properties:

Option

Description

req

The Express request object containing the currently authenticated user

Update

Returns a boolean result or optionally a query constraint which limits who can update this global based on its current properties.

Available argument properties:

Option

Description

req

The Express request object containing the currently authenticated user

data

The data passed to update the global with.

Next

Hooks Overview