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 axios from "axios";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import CallAPI from "./call-api";
|
import CallAPI from "./call-api";
|
||||||
|
|
@ -42,7 +29,11 @@ class CheckAuth {
|
||||||
return role.attrPrivilege;
|
return role.attrPrivilege;
|
||||||
})
|
})
|
||||||
.catch((x) => {
|
.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) {
|
public async PermissionOrg(req: RequestWithUser, system: string, action: string) {
|
||||||
|
|
@ -123,7 +114,11 @@ class CheckAuth {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.catch((x) => {
|
.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(
|
public async PermissionOrgByUser(
|
||||||
|
|
@ -174,8 +169,8 @@ class CheckAuth {
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.catch((x) => {
|
.catch((x) => {
|
||||||
if (x.status == 403) {
|
if (x.status != undefined) {
|
||||||
throw new HttpError(HttpStatus.FORBIDDEN, x.message);
|
throw new HttpError(x.status, x.message);
|
||||||
} else {
|
} else {
|
||||||
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
throw new HttpError(HttpStatus.FORBIDDEN, x);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue