diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index e1988227..9c2c0c3c 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -79,6 +79,7 @@ export class KeycloakController extends Controller { firstName?: string; lastName?: string; email?: string; + roles?: string[]; }, ) { const userId = await createUser(body.username, body.password, { @@ -128,7 +129,10 @@ export class KeycloakController extends Controller { // }); // io.getInstance()?.emit("FolderCreate", folderData); - + const _roles = { + role: body.roles || [], + }; + const addRole = await this.addRole(userId, _roles); return userId; } @@ -142,7 +146,8 @@ export class KeycloakController extends Controller { firstName?: string; lastName?: string; email?: string; - attributes?: object + attributes?: object; + // roles?: string[]; }, ) { // return await editUser(userId, body); @@ -150,6 +155,10 @@ export class KeycloakController extends Controller { if (typeof chkUpdate !== "boolean") { throw new Error(chkUpdate.errorMessage); } + // const _rolesUpdate = { + // role: body.roles || [], + // }; + // const addRole = await this.addRole(userId, _rolesUpdate); return chkUpdate }