error permission
This commit is contained in:
parent
bd1f889fba
commit
a2e3c79a7c
1 changed files with 12 additions and 17 deletions
|
|
@ -1,16 +1,3 @@
|
|||
import {
|
||||
Controller,
|
||||
Request,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Patch,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Path,
|
||||
} from "tsoa";
|
||||
import axios from "axios";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import CallAPI from "./call-api";
|
||||
|
|
@ -42,7 +29,11 @@ class CheckAuth {
|
|||
return role.attrPrivilege;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
});
|
||||
}
|
||||
public async PermissionOrg(req: RequestWithUser, system: string, action: string) {
|
||||
|
|
@ -123,7 +114,11 @@ class CheckAuth {
|
|||
return data;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
});
|
||||
}
|
||||
public async PermissionOrgByUser(
|
||||
|
|
@ -174,8 +169,8 @@ class CheckAuth {
|
|||
return true;
|
||||
})
|
||||
.catch((x) => {
|
||||
if (x.status == 403) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x.message);
|
||||
if (x.status != undefined) {
|
||||
throw new HttpError(x.status, x.message);
|
||||
} else {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue