เช็คสิทธิ์

This commit is contained in:
kittapath 2024-08-20 17:28:00 +07:00
parent 0d3e502513
commit edad154826

View file

@ -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;
})