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

FunctionAllows/Denies Access
readUsed in the findOne Global operation
updateUsed 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:

OptionDescription
reqThe 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:

OptionDescription
reqThe Express request object containing the currently authenticated user
dataThe data passed to update the global with.
Next

Hooks Overview