#2523 STAFF + isDirector ให้ล้อสิทธิ์เหมือน CHILD

This commit is contained in:
harid 2026-05-26 13:20:02 +07:00
parent 7b22fb2a2d
commit 0cad83af1f
2 changed files with 12 additions and 3 deletions

View file

@ -39,7 +39,7 @@ class CheckAuth {
}
});
}
public async PermissionOrg(req: RequestWithUser, system: string, action: string) {
public async PermissionOrg(req: RequestWithUser, system: string, action: string, isDirector?: boolean) {
if (
req.headers.hasOwnProperty("api_key") &&
req.headers["api_key"] &&
@ -56,7 +56,7 @@ class CheckAuth {
return await new CallAPI()
.GetData(req, `/org/permission/org/${system}/${action}`)
.then(async (x) => {
let privilege = x.privilege;
let privilege = isDirector && isDirector === true ? "CHILD" : x.privilege;
let data: any = {
root: [null],
@ -288,6 +288,9 @@ class CheckAuth {
public async PermissionOrgList(req: RequestWithUser, system: string) {
return await this.PermissionOrg(req, system, "LIST");
}
public async PermissionIsDirectorOrgList(req: RequestWithUser, system: string, isDirector: boolean) {
return await this.PermissionOrg(req, system, "LIST", isDirector);
}
public async PermissionOrgUpdate(req: RequestWithUser, system: string) {
return await this.PermissionOrg(req, system, "UPDATE");
}