From edad154826276a1c10126236591b415fde790db7 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 20 Aug 2024 17:28:00 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=8A=E0=B9=87=E0=B8=84=E0=B8=AA?= =?UTF-8?q?=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interfaces/permission.ts | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 65a574c8..16690180 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -138,11 +138,11 @@ class CheckAuth { .GetData(req, `/org/permission/user/${profileId}`) .then(async (x) => { let org = { - orgRootId: [null], - orgChild1Id: [null], - orgChild2Id: [null], - orgChild3Id: [null], - orgChild4Id: [null], + root: [null], + child1: [null], + child2: [null], + child3: [null], + child4: [null], }; if (action.trim().toLocaleUpperCase() == "CREATE") org = await this.PermissionOrgCreate(req, system); @@ -155,16 +155,15 @@ class CheckAuth { if (action.trim().toLocaleUpperCase() == "UPDATE") org = await this.PermissionOrgUpdate(req, system); - if (org.orgRootId != null) - if (x.orgRootId != org.orgRootId[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; - if (org.orgChild1Id != null) - if (x.orgChild1Id != org.orgChild1Id[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; - if (org.orgChild2Id != null) - if (x.orgChild2Id != org.orgChild2Id[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; - if (org.orgChild3Id != null) - if (x.orgChild3Id != org.orgChild3Id[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; - if (org.orgChild4Id != null) - if (x.orgChild4Id != org.orgChild4Id[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; + if (org.root != null) if (x.orgRootId != org.root[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; + if (org.child1 != null) + if (x.orgChild1Id != org.child1[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; + if (org.child2 != null) + if (x.orgChild2Id != org.child2[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; + if (org.child3 != null) + if (x.orgChild3Id != org.child3[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; + if (org.child4 != null) + if (x.orgChild4Id != org.child4[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"; return true; })