no message
This commit is contained in:
parent
0b8f9b6c23
commit
a48656bdc9
2 changed files with 22 additions and 26 deletions
|
|
@ -30,7 +30,7 @@ import {
|
|||
getRoleMappings,
|
||||
getUserCount,
|
||||
enableStatus,
|
||||
getUserByUsername
|
||||
getUserByUsername,
|
||||
} from "../keycloak";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { Profile } from "../entities/Profile";
|
||||
|
|
@ -97,15 +97,21 @@ export class KeycloakController extends Controller {
|
|||
profileId?: string;
|
||||
},
|
||||
) {
|
||||
const userId = await createUser(body.username, body.password, {
|
||||
firstName: body.firstName,
|
||||
lastName: body.lastName,
|
||||
// email: body.email,
|
||||
});
|
||||
|
||||
if (typeof userId !== "string") {
|
||||
throw new Error(userId.errorMessage);
|
||||
const checkUser = await getUserByUsername(body.username);
|
||||
let userId: any = "";
|
||||
if (checkUser.length == 0) {
|
||||
userId = await createUser(body.username, body.password, {
|
||||
firstName: body.firstName,
|
||||
lastName: body.lastName,
|
||||
// email: body.email,
|
||||
});
|
||||
if (typeof userId !== "string") {
|
||||
throw new Error(userId.errorMessage);
|
||||
}
|
||||
} else {
|
||||
userId = checkUser[0].id;
|
||||
}
|
||||
|
||||
const list = await getRoles();
|
||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||
const result = await addUserRoles(
|
||||
|
|
@ -709,7 +715,7 @@ export class KeycloakController extends Controller {
|
|||
roles: rolesData,
|
||||
};
|
||||
|
||||
return userDataWithRoles
|
||||
return userDataWithRoles;
|
||||
}
|
||||
|
||||
@Put("user/{userId}/enableStatus/{status}") //#log?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue