From f8ca0da8b362379edff0c4277faf8e0163f1b526 Mon Sep 17 00:00:00 2001 From: Katherine Date: Wed, 6 Nov 2024 12:04:58 +0800 Subject: [PATCH] fix: validate association field permissions when checking association collection field permissions (#5569) --- packages/core/client/src/acl/ACLProvider.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/acl/ACLProvider.tsx b/packages/core/client/src/acl/ACLProvider.tsx index 0a8f685ca9..c7266ef8ee 100644 --- a/packages/core/client/src/acl/ACLProvider.tsx +++ b/packages/core/client/src/acl/ACLProvider.tsx @@ -297,7 +297,7 @@ export const useACLFieldWhitelist = () => { return { whitelist, schemaInWhitelist: useCallback( - (fieldSchema: Schema, isSkip?) => { + (fieldSchema: Schema | any, isSkip?) => { if (isSkip) { return true; } @@ -311,7 +311,8 @@ export const useACLFieldWhitelist = () => { return true; } const [key1, key2] = fieldSchema['x-collection-field'].split('.'); - return whitelist?.includes(key2 || key1); + const [associationField] = fieldSchema['name'].split('.'); + return whitelist?.includes(associationField || key2 || key1); }, [whitelist], ),