fix update prefix and profileId
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m45s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m45s
This commit is contained in:
parent
e4f46a1762
commit
2951630b7b
10 changed files with 201 additions and 69 deletions
|
|
@ -64,6 +64,7 @@ import {
|
|||
getRoleMappings,
|
||||
removeUserRoles,
|
||||
getToken,
|
||||
updateUserAttributes,
|
||||
} from "../keycloak";
|
||||
import { ProfileEducation, CreateProfileEducation } from "../entities/ProfileEducation";
|
||||
import { ProfileEducationHistory } from "../entities/ProfileEducationHistory";
|
||||
|
|
@ -4242,6 +4243,12 @@ export class CommandController extends Controller {
|
|||
profile.isActive = true;
|
||||
}
|
||||
await this.profileRepository.save(profile);
|
||||
// update user attribute in keycloak
|
||||
await updateUserAttributes(profile.keycloak ?? "", {
|
||||
profileId: [profile.id],
|
||||
prefix: [profile.prefix || ""],
|
||||
});
|
||||
|
||||
// Task #2190
|
||||
if (code && ["C-PM-17", "C-PM-18"].includes(code)) {
|
||||
let organizeName = "";
|
||||
|
|
@ -6329,8 +6336,7 @@ export class CommandController extends Controller {
|
|||
name: x.name,
|
||||
})),
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
userKeycloakId = checkUser[0].id;
|
||||
const rolesData = await getRoleMappings(userKeycloakId);
|
||||
if (rolesData) {
|
||||
|
|
@ -6393,9 +6399,9 @@ export class CommandController extends Controller {
|
|||
if (profileEmployee.keycloak != null) {
|
||||
// const delUserKeycloak = await deleteUser(profileEmployee.keycloak);
|
||||
// if (delUserKeycloak) {
|
||||
profileEmployee.keycloak = _null;
|
||||
profileEmployee.roleKeycloaks = [];
|
||||
profileEmployee.isActive = false;
|
||||
profileEmployee.keycloak = _null;
|
||||
profileEmployee.roleKeycloaks = [];
|
||||
profileEmployee.isActive = false;
|
||||
// }
|
||||
}
|
||||
profileEmployee.isLeave = true;
|
||||
|
|
@ -6448,6 +6454,11 @@ export class CommandController extends Controller {
|
|||
profile.phone = item.bodyProfile.phone ?? null;
|
||||
|
||||
await this.profileRepository.save(profile);
|
||||
// update user attribute in keycloak
|
||||
await updateUserAttributes(profile.keycloak ?? "", {
|
||||
profileId: [profile.id],
|
||||
prefix: [profile.prefix || ""],
|
||||
});
|
||||
setLogDataDiff(req, { before, after: profile });
|
||||
}
|
||||
//ขรก.ในระบบ หรือ ขรก.ในระบบที่สถานะพ้นจากราชการ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue