feat: filter out internal roles (3 for now)

This commit is contained in:
Methapon2001 2024-04-10 10:32:28 +07:00
parent 27e545adcd
commit 8ab2ab156f

View file

@ -33,7 +33,11 @@ export class KeycloakController extends Controller {
@Get("role")
async getRole() {
const role = await getRoles();
if (Array.isArray(role)) return role;
if (Array.isArray(role))
return role.filter(
(a) =>
!["uma_authorization", "offline_access", "default-roles"].some((b) => a.name.includes(b)),
);
throw new Error("Failed. Cannot get role.");
}