bug create user
This commit is contained in:
parent
f953ba6d27
commit
a354fe74fe
1 changed files with 20 additions and 9 deletions
|
|
@ -143,10 +143,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,6 +153,21 @@ export class KeycloakController extends Controller {
|
|||
if (profile) {
|
||||
profile.keycloak = userId;
|
||||
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;
|
||||
}
|
||||
|
|
@ -183,7 +194,6 @@ export class KeycloakController extends Controller {
|
|||
// const _rolesUpdate = {
|
||||
// role: body.roles || [],
|
||||
// };
|
||||
// const addRole = await this.addRole(userId, _rolesUpdate);
|
||||
return chkUpdate;
|
||||
}
|
||||
|
||||
|
|
@ -498,13 +508,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