Merge pull request #1690 from payloadcms/fix/doc-access

fix: doc access should not run where query on collections without id
This commit is contained in:
James Mikrut
2022-12-16 17:39:39 -05:00
committed by GitHub

View File

@@ -101,7 +101,7 @@ export function getEntityPolicies<T extends Args>(args: T): ReturnType<T> {
if (typeof accessResult === 'object' && !disableWhere) {
mutablePolicies[operation] = {
permission: !!(await getEntityDoc({ where: accessResult })),
permission: (id || type === 'global') ? !!(await getEntityDoc({ where: accessResult })) : true,
where: accessResult,
};
} else if (mutablePolicies[operation]?.permission !== false) {