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);
|
// io.getInstance()?.emit("FolderCreate", folderData);
|
||||||
const _roles = {
|
|
||||||
role: body.roles || [],
|
|
||||||
};
|
|
||||||
const addRole = await this.addRole(userId, _roles);
|
|
||||||
|
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -157,6 +153,21 @@ export class KeycloakController extends Controller {
|
||||||
if (profile) {
|
if (profile) {
|
||||||
profile.keycloak = userId;
|
profile.keycloak = userId;
|
||||||
await this.profileRepo.save(profile);
|
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;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +194,6 @@ export class KeycloakController extends Controller {
|
||||||
// const _rolesUpdate = {
|
// const _rolesUpdate = {
|
||||||
// role: body.roles || [],
|
// role: body.roles || [],
|
||||||
// };
|
// };
|
||||||
// const addRole = await this.addRole(userId, _rolesUpdate);
|
|
||||||
return chkUpdate;
|
return chkUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -498,13 +508,14 @@ export class KeycloakController extends Controller {
|
||||||
const result = await createGroup(body.name);
|
const result = await createGroup(body.name);
|
||||||
if (!result) throw new Error("Failed. Cannot create group.");
|
if (!result) throw new Error("Failed. Cannot create group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post("log/sso")
|
@Post("log/sso")
|
||||||
async addLogSSO(
|
async addLogSSO(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body() body: {
|
@Body()
|
||||||
text: string,
|
body: {
|
||||||
}
|
text: string;
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
addLogSequence(req, {
|
addLogSequence(req, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue