Merge pull request #1211 from jacobsfletch/master
feat: async admin access control
This commit is contained in:
@@ -31,7 +31,22 @@ const UseRequestHeadersAccess: FieldAccess = ({ req: { headers } }) => {
|
||||
};
|
||||
|
||||
export default buildConfig({
|
||||
admin: {
|
||||
user: 'users'
|
||||
},
|
||||
collections: [
|
||||
{
|
||||
slug: 'users',
|
||||
auth: true,
|
||||
access: {
|
||||
// admin: () => true,
|
||||
admin: async () => new Promise((resolve) => {
|
||||
// Simulate a request to an external service to determine access, i.e. another instance of Payload
|
||||
setTimeout(resolve, 50, true); // set to 'true' or 'false' here to simulate the response
|
||||
}),
|
||||
},
|
||||
fields: []
|
||||
},
|
||||
{
|
||||
slug,
|
||||
access: {
|
||||
|
||||
Reference in New Issue
Block a user