From fba87e27c1cb6c679fff0d2c50be230f7e0c3e56 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Dec 2021 15:30:36 +0100 Subject: Resolve enums at compile time --- server/helpers/custom-validators/users.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 105c36600..b04970108 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -90,7 +90,7 @@ function isUserBlockedReasonValid (value: any) { } function isUserRoleValid (value: any) { - return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined + return exists(value) && validator.isInt('' + value) && [ UserRole.ADMINISTRATOR, UserRole.MODERATOR, UserRole.USER ].includes(value) } // --------------------------------------------------------------------------- -- cgit v1.2.3