Merge pull request #1211 from jacobsfletch/master

feat: async admin access control
This commit is contained in:
James Mikrut
2022-10-06 13:31:01 -04:00
committed by GitHub
3 changed files with 18 additions and 3 deletions

View File

@@ -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: {