Payload is now completely free and open-source.
If you like what we're doing, stop by GitHub and give us a star!

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:

import { GlobalConfig } from 'payload/types';
const Header: GlobalConfig = {
slug: "header",
access: {
read: ({ req: { user } }) => { /* */ },
update: ({ req: { user } }) => { /* */ },
},
};
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