Improve recursive filtering (#4493)

* Use lowercase chars only

* Fix join alias mapping

* Pass keys as array in delete

* Cleanup delete controller

* Don't catch unexpected errors
This commit is contained in:
Rijk van Zanten
2021-03-11 17:56:04 -05:00
committed by GitHub
parent 7bd5dc5c9f
commit b613ce1d18
4 changed files with 31 additions and 31 deletions

View File

@@ -334,21 +334,13 @@ export class AuthorizationService {
schema: this.schema,
});
try {
const query: Query = {
fields: ['*'],
};
const query: Query = {
fields: ['*'],
};
const result = await itemsService.readByKey(pk as any, query, action);
const result = await itemsService.readByKey(pk as any, query, action);
if (!result) throw '';
if (Array.isArray(pk) && pk.length > 1 && result.length !== pk.length) throw '';
} catch {
throw new ForbiddenException(`You're not allowed to ${action} item "${pk}" in collection "${collection}".`, {
collection,
item: pk,
action,
});
}
if (!result) throw new ForbiddenException();
if (Array.isArray(pk) && pk.length > 1 && result.length !== pk.length) throw new ForbiddenException();
}
}