More authorization checks
Some more checks to ensure that users can do only what they're allowed to.
@User() user: RequestUser,export const compareUserId = (userId: number, requiredId: number) => {
if (userId !== requiredId) {
throw new ForbiddenException('Forbidden resource');
}
};if (currentUser.role !== Role.ADMIN) {
compareUserId(currentUser.id, id);
}Last updated