ปั๊ม role เดิม

This commit is contained in:
Bright 2025-01-23 09:52:48 +07:00
parent 9f5f1af6e2
commit c26aad70bd

View file

@ -2589,7 +2589,13 @@ export class CommandController extends Controller {
}
//ถ้ามีอยู่แล้วให้ใช้อันเดิม
else {
// const _roleKeycloaks = await getRoleMappings(checkUser[0].id);
const rolesData = await getRoleMappings(checkUser[0].id);
if(rolesData) {
const _roleKeycloak = await this.roleKeycloakRepo.find({
where: { name: In(rolesData.map((x:any) => x.name)) }
});
profile.roleKeycloaks = _roleKeycloak && _roleKeycloak.length > 0 ? _roleKeycloak : [];
}
profile.keycloak = checkUser[0].id;
}
profile.amount = item.amount ?? _null;
@ -3942,6 +3948,13 @@ export class CommandController extends Controller {
profile.keycloak = userKeycloakId && typeof userKeycloakId === "string" ? userKeycloakId : "";
}
else {
const rolesData = await getRoleMappings(checkUser[0].id);
if(rolesData) {
const _roleKeycloak = await this.roleKeycloakRepo.find({
where: { name: In(rolesData.map((x:any) => x.name)) }
});
profile.roleKeycloaks = _roleKeycloak && _roleKeycloak.length > 0 ? _roleKeycloak : [];
}
profile.keycloak = checkUser[0].id;
}
@ -4339,6 +4352,13 @@ export class CommandController extends Controller {
// End Create Keycloak
}
else {
const rolesData = await getRoleMappings(checkUser[0].id);
if(rolesData) {
const _roleKeycloak = await this.roleKeycloakRepo.find({
where: { name: In(rolesData.map((x:any) => x.name)) }
});
profile.roleKeycloaks = _roleKeycloak && _roleKeycloak.length > 0 ? _roleKeycloak : [];
}
profile.keycloak = checkUser[0].id;
}