fix: code not return
This commit is contained in:
parent
33d5e6ef4c
commit
7782772e50
1 changed files with 5 additions and 1 deletions
|
|
@ -47,7 +47,11 @@ export async function keycloakAuth(request: Express.Request, roles?: string[]) {
|
||||||
|
|
||||||
if (Array.isArray(payload.roles) && Array.isArray(roles) && roles.length > 0) {
|
if (Array.isArray(payload.roles) && Array.isArray(roles) && roles.length > 0) {
|
||||||
if (!roles.some((a: string) => payload.roles.includes(a))) {
|
if (!roles.some((a: string) => payload.roles.includes(a))) {
|
||||||
throw new HttpError(HttpStatus.FORBIDDEN, "คุณไม่มีสิทธิในการเข้าถึงข้อมูลดังกล่าว");
|
throw new HttpError(
|
||||||
|
HttpStatus.FORBIDDEN,
|
||||||
|
"คุณไม่มีสิทธิในการเข้าถึงข้อมูลดังกล่าว",
|
||||||
|
"noPermission",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue