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

@ -27,6 +27,7 @@ import {
listRole,
getUserRoles,
removeUserRoles,
getGroupUser,
} from "../services/keycloak";
import { isSystem } from "../utils/keycloak";
import {
@ -947,3 +948,17 @@ export class UserSignatureController extends Controller {
await deleteFile(fileLocation.user.signature(userId));
}
}
@Route("api/v1/user/{userId}/group")
@Tags("User")
@Security("keycloak")
export class UserGroupController extends Controller {
@Get()
async getUserGroup(@Path() userId: string) {
const groupUser = await getGroupUser(userId);
if (!Array.isArray(groupUser))
throw new Error("Failed. Cannot get user group(s) data from the server.");
return groupUser;
}
}