From e161335f368804b3c9b8f9ae1014550b077f16ea Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 19 Feb 2026 14:46:09 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C=20PARENT?= =?UTF-8?q?=20=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B9=80=E0=B8=AB=E0=B9=87?= =?UTF-8?q?=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5?= =?UTF-8?q?=E0=B8=97=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B8=AB=E0=B8=A1=E0=B8=94?= =?UTF-8?q?=E0=B8=97=E0=B8=B8=E0=B8=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=A7?= =?UTF-8?q?=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99=20#54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/EvaluationController.ts | 64 +++++++++++++------------ src/interfaces/permission.ts | 6 ++- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/controllers/EvaluationController.ts b/src/controllers/EvaluationController.ts index 9738620..3150f00 100644 --- a/src/controllers/EvaluationController.ts +++ b/src/controllers/EvaluationController.ts @@ -161,7 +161,7 @@ export class EvaluationController { let nodeId = resolveNodeId(orgDna); let conditions: string[] = []; let params: any = {}; - if (_data.privilege === "CHILD" || _data.privilege === "PARENT" || _data.privilege === "BROTHER") { + if (_data.privilege === "CHILD" || /*_data.privilege === "PARENT" ||*/ _data.privilege === "BROTHER") { if (_data.privilege === "CHILD") { if (level === 0 && orgDna.rootDnaId) { @@ -195,7 +195,8 @@ export class EvaluationController { params, }; } - } else if (_data.privilege === "BROTHER") { + } + else if (_data.privilege === "BROTHER") { const parentLevel = level !== null ? level - 1 : null; if (parentLevel != null && parentLevel === 0 && orgDna.rootDnaId) { conditions.push("evaluation.rootDnaId = :root"); @@ -223,36 +224,37 @@ export class EvaluationController { params, }; } - } else if (_data.privilege === "PARENT") { - if (level === 0) { - if (orgDna.rootDnaId) { - conditions.push("evaluation.rootDnaId = :root"); - params.root = orgDna.rootDnaId; - } - } else if (level === 1) { - if (orgDna.rootDnaId) { - conditions.push("evaluation.rootDnaId = :root AND evaluation.child1DnaId IS NOT NULL"); - params.root = orgDna.rootDnaId; - } - } else if (level === 2) { - conditions.push("evaluation.child1DnaId = :child1 AND evaluation.child2DnaId IS NOT NULL"); - params.child1 = orgDna.child1DnaId; - } else if (level === 3) { - conditions.push("evaluation.child2DnaId = :child2 AND evaluation.child3DnaId IS NOT NULL"); - params.child2 = orgDna.child2DnaId; - } else if (level === 4) { - conditions.push("evaluation.child3DnaId = :child3 AND evaluation.child4DnaId IS NOT NULL"); - params.child3 = orgDna.child3DnaId; - } + } + // else if (_data.privilege === "PARENT") { + // if (level === 0) { + // if (orgDna.rootDnaId) { + // conditions.push("evaluation.rootDnaId = :root"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 1) { + // if (orgDna.rootDnaId) { + // conditions.push("evaluation.rootDnaId = :root AND evaluation.child1DnaId IS NOT NULL"); + // params.root = orgDna.rootDnaId; + // } + // } else if (level === 2) { + // conditions.push("evaluation.child1DnaId = :child1 AND evaluation.child2DnaId IS NOT NULL"); + // params.child1 = orgDna.child1DnaId; + // } else if (level === 3) { + // conditions.push("evaluation.child2DnaId = :child2 AND evaluation.child3DnaId IS NOT NULL"); + // params.child2 = orgDna.child2DnaId; + // } else if (level === 4) { + // conditions.push("evaluation.child3DnaId = :child3 AND evaluation.child4DnaId IS NOT NULL"); + // params.child3 = orgDna.child3DnaId; + // } - if (conditions.length > 0) { - typeCondition = { - query: conditions.join(" AND "), - params, - }; - } - } - } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT") { + // if (conditions.length > 0) { + // typeCondition = { + // query: conditions.join(" AND "), + // params, + // }; + // } + // } + } else if (_data.privilege === "OWNER" || _data.privilege === "ROOT" || _data.privilege === "PARENT") { if (orgDna.rootDnaId) { conditions.push("evaluation.rootDnaId = :root"); params.root = orgDna.rootDnaId; diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 646b4c6..cd077da 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -96,8 +96,10 @@ class CheckAuth { }; } else if (privilege == "PARENT") { data = { - root: [x.orgRootId], - child1: [null], + // root: [x.orgRootId], + // child1: [null], + root: null, + child1: null, child2: null, child3: null, child4: null,