fix(acl): skip when field does not exist

This commit is contained in:
chenos 2022-06-03 22:20:34 +08:00
parent b9ba44f36e
commit d72480ac58

View File

@ -44,6 +44,12 @@ export class RoleResourceActionModel extends Model {
for (const field of fields) { for (const field of fields) {
const collectionField = collection.getField(field); const collectionField = collection.getField(field);
if (!collectionField) {
console.log(`${field} does not exist`);
continue;
}
const fieldType = collectionField.get('interface') as string; const fieldType = collectionField.get('interface') as string;
const fieldActions: AssociationFieldAction = associationFieldsActions?.[fieldType]?.[availableAction]; const fieldActions: AssociationFieldAction = associationFieldsActions?.[fieldType]?.[availableAction];