fix: validate association field permissions when checking association collection field permissions (#5569)

This commit is contained in:
Katherine 2024-11-06 12:04:58 +08:00 committed by GitHub
parent a359ddef4c
commit f8ca0da8b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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],
),