From bb3ed504c0faf62c7d83b4ddcb5e1cfeb6ec3479 Mon Sep 17 00:00:00 2001 From: harid Date: Mon, 2 Mar 2026 12:01:17 +0700 Subject: [PATCH] fix bug --- src/interfaces/permission.ts | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 566c8c3..03ec6b0 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -128,7 +128,6 @@ class CheckAuth { privilege: "CHILD", }; } else if (privilege == "BROTHER") { - const minLevel = node === 0 ? 0 : node - 1; data = { // root: node >= 0 ? [x.orgRootId] : null, /* @@ -137,35 +136,20 @@ class CheckAuth { child2: node >= 3 ? [x.orgChild2Id] : null, child3: node >= 4 ? [x.orgChild3Id] : null, */ - root: - minLevel <= 0 && x.orgRootId - ? [x.orgRootId] - : null, - child1: - minLevel <= 1 && x.orgChild1Id - ? [x.orgChild1Id] - : null, - child2: - minLevel <= 2 && x.orgChild2Id - ? [x.orgChild2Id] - : null, - child3: - minLevel <= 3 && x.orgChild3Id - ? [x.orgChild3Id] - : null, - child4: - minLevel <= 4 && x.orgChild4Id - ? [x.orgChild4Id] - : null, + root: (node == 0 || node == 1) ? [x.orgRootId] : null, + child1: node == 2 ? [x.orgChild1Id] : null, + child2: node == 3 ? [x.orgChild2Id] : null, + child3: node == 4 ? [x.orgChild3Id] : null, + child4: node == 4 ? [x.orgChild4Id] : null, privilege: "BROTHER", }; } else if (privilege == "NORMAL") { data = { - root: node == 0 ? [x.orgRootId] : null, - child1: node == 1 ? [x.orgChild1Id] : null, - child2: node == 2 ? [x.orgChild2Id] : null, - child3: node == 3 ? [x.orgChild3Id] : null, - child4: node == 4 ? [x.orgChild4Id] : null, + root: x.orgRootId != null ? [x.orgRootId] : [], + child1: x.orgChild1Id != null ? [x.orgChild1Id] : [], + child2: x.orgChild2Id != null ? [x.orgChild2Id] : [], + child3: x.orgChild3Id != null ? [x.orgChild3Id] : [], + child4: x.orgChild4Id != null ? [x.orgChild4Id] : [], privilege: "NORMAL", }; } else if (privilege == "SPECIFIC") {