From 640668decb4b0307f88684ee474d91625d6b4baa Mon Sep 17 00:00:00 2001 From: kittapath Date: Sun, 15 Dec 2024 20:40:11 +0700 Subject: [PATCH] delete comment --- src/controllers/LoginController.ts | 4 ++-- src/controllers/UserController.ts | 8 ++++++++ src/controllers/WorkflowController.ts | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/controllers/LoginController.ts b/src/controllers/LoginController.ts index 12ae4b5c..b2040bed 100644 --- a/src/controllers/LoginController.ts +++ b/src/controllers/LoginController.ts @@ -42,11 +42,11 @@ export class LoginController extends Controller { _data = x; }) .catch(async (x) => { - throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง4"); + throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง"); }), ]); if (_data == null) { - return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง5"); + return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง"); } else { return new HttpSuccess(_data); } diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index a2fccac7..80ce63d4 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -107,6 +107,14 @@ export class KeycloakController extends Controller { } const list = await getRoles(); if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server."); + const result = await addUserRoles( + userId, + list.filter((v) => body.roles.includes(v.id)), + ); + + if (!result) { + throw new Error("Failed. Cannot set user's role."); + } const profile = await this.profileRepo.findOne({ where: { id: body.profileId, diff --git a/src/controllers/WorkflowController.ts b/src/controllers/WorkflowController.ts index 5e1d2df7..a26cf3e5 100644 --- a/src/controllers/WorkflowController.ts +++ b/src/controllers/WorkflowController.ts @@ -817,7 +817,7 @@ export class WorkflowController extends Controller { orgRootId: posMasterUser.orgRootId, }; - if (type.trim().toLowerCase() == "OPERATE") { + if (type.trim().toUpperCase() == "OPERATE") { } else { if ( (posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&