add group from keycloak
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 7s

This commit is contained in:
Kanjana 2025-04-22 14:02:36 +07:00
parent 3bf2446611
commit 94c7de89eb
3 changed files with 92 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import { Body, Controller, Delete, Get, Path, Post, Route, Security, Tags } from "tsoa";
import { addUserRoles, listRole, removeUserRoles } from "../services/keycloak";
import { addUserRoles, getGroup, listRole, removeUserRoles } from "../services/keycloak";
@Route("api/v1/keycloak")
@Tags("Single-Sign On")
@ -44,4 +44,12 @@ export class KeycloakController extends Controller {
);
if (!result) throw new Error("Failed. Cannot remove user's role.");
}
@Get("group")
async getGroup() {
const group = await getGroup();
if (!Array.isArray(group)) throw new Error("Failed. Cannot get group(s) data from the server.");
return group;
}
}