Merge branch 'develop' into adiDev
This commit is contained in:
commit
4edf59ecd1
11 changed files with 189 additions and 465 deletions
|
|
@ -145,10 +145,6 @@ export class KeycloakController extends Controller {
|
|||
// });
|
||||
|
||||
// io.getInstance()?.emit("FolderCreate", folderData);
|
||||
const _roles = {
|
||||
role: body.roles || [],
|
||||
};
|
||||
const addRole = await this.addRole(userId, _roles);
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: {
|
||||
|
|
@ -157,8 +153,25 @@ export class KeycloakController extends Controller {
|
|||
});
|
||||
|
||||
if (profile) {
|
||||
let _null: any = null;
|
||||
profile.keycloak = userId;
|
||||
profile.email = body.email == null ? _null : body.email;
|
||||
await this.profileRepo.save(profile);
|
||||
if (body.roles != null && body.roles.length > 0) {
|
||||
const roleKeycloak = await this.roleKeycloakRepo.find({
|
||||
where: { id: In(body.roles) },
|
||||
});
|
||||
const _profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: userId },
|
||||
relations: ["roleKeycloaks"],
|
||||
});
|
||||
if (_profile) {
|
||||
_profile.roleKeycloaks = Array.from(
|
||||
new Set([..._profile.roleKeycloaks, ...roleKeycloak]),
|
||||
);
|
||||
this.profileRepo.save(_profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
|
|
@ -185,7 +198,6 @@ export class KeycloakController extends Controller {
|
|||
// const _rolesUpdate = {
|
||||
// role: body.roles || [],
|
||||
// };
|
||||
// const addRole = await this.addRole(userId, _rolesUpdate);
|
||||
return chkUpdate;
|
||||
}
|
||||
|
||||
|
|
@ -560,13 +572,14 @@ export class KeycloakController extends Controller {
|
|||
const result = await createGroup(body.name);
|
||||
if (!result) throw new Error("Failed. Cannot create group.");
|
||||
}
|
||||
|
||||
|
||||
@Post("log/sso")
|
||||
async addLogSSO(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: {
|
||||
text: string,
|
||||
}
|
||||
@Body()
|
||||
body: {
|
||||
text: string;
|
||||
},
|
||||
) {
|
||||
try {
|
||||
addLogSequence(req, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue