permission (.NET)
This commit is contained in:
parent
53787597fd
commit
46e37a3451
3 changed files with 25 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ import { Profile } from "../entities/Profile";
|
||||||
import { AuthSys } from "../entities/AuthSys";
|
import { AuthSys } from "../entities/AuthSys";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { In } from "typeorm";
|
import { In } from "typeorm";
|
||||||
|
import permission from "../interfaces/permission";
|
||||||
const REDIS_HOST = process.env.REDIS_HOST;
|
const REDIS_HOST = process.env.REDIS_HOST;
|
||||||
const REDIS_PORT = process.env.REDIS_PORT;
|
const REDIS_PORT = process.env.REDIS_PORT;
|
||||||
|
|
||||||
|
|
@ -177,4 +178,25 @@ export class PermissionController extends Controller {
|
||||||
|
|
||||||
return new HttpSuccess(reply);
|
return new HttpSuccess(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API permission (dotnet api)
|
||||||
|
* @summary permission (dotnet api)
|
||||||
|
* @param {string} method Method
|
||||||
|
* @param {string} system authSysId
|
||||||
|
*/
|
||||||
|
@Get("dotnet/{method}/{system}")
|
||||||
|
public async dotnet(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Path() method: string,
|
||||||
|
@Path() system: string
|
||||||
|
) {
|
||||||
|
|
||||||
|
if(!["CREATE", "DELETE", "GET", "LIST", "UPDATE"].includes(method)) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "Method ไม่ถูกต้อง");
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = await new permission().Permission(req, system.toLocaleUpperCase(), method);
|
||||||
|
return new HttpSuccess(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export class AuthRoleAttr extends EntityBase {
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สิทธิการเข้าถึง(Privilege)",
|
comment: "สิทธิ์การเข้าถึง(Privilege)",
|
||||||
length: 255,
|
length: 255,
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@ import HttpStatus from "./http-status";
|
||||||
|
|
||||||
class CheckAuth {
|
class CheckAuth {
|
||||||
public async Permission(req: RequestWithUser, system: string, action: string) {
|
public async Permission(req: RequestWithUser, system: string, action: string) {
|
||||||
console.log(req);
|
// console.log(req);
|
||||||
|
return await new CallAPI()
|
||||||
await new CallAPI()
|
|
||||||
.GetData(req, "/org/permission")
|
.GetData(req, "/org/permission")
|
||||||
.then((x) => {
|
.then((x) => {
|
||||||
let permission = false;
|
let permission = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue