From 0500f4410d93cfec0d1c438456cd2ca4ba13c060 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 27 Feb 2026 18:07:27 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B8=97=E0=B8=94=E0=B8=A5?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=84=E0=B8=A1=E0=B9=88?= =?UTF-8?q?=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=95=E0=B8=B2=E0=B8=A1?= =?UTF-8?q?=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C=20#1550?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interfaces/permission.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 771cf12..e955f41 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -128,21 +128,29 @@ class CheckAuth { privilege: "CHILD", }; } else if (privilege == "BROTHER") { + const minLevel = node === 0 ? 0 : node - 1; data = { // root: node >= 0 ? [x.orgRootId] : null, + /* root: node >= 0 ? [x.orgRootId] : null, child1: node >= 2 ? [x.orgChild1Id] : null, child2: node >= 3 ? [x.orgChild2Id] : null, child3: node >= 4 ? [x.orgChild3Id] : null, + */ + root: minLevel <= 0 ? [x.orgRootId] : null, + child1: minLevel <= 1 ? [x.orgChild1Id] : null, + child2: minLevel <= 2 ? [x.orgChild2Id] : null, + child3: minLevel <= 3 ? [x.orgChild3Id] : null, + child4: minLevel <= 4 ? [x.orgChild4Id] : null, privilege: "BROTHER", }; } else if (privilege == "NORMAL") { data = { - root: [x.orgRootId], - child1: [x.orgChild1Id], - child2: [x.orgChild2Id], - child3: [x.orgChild3Id], - child4: [x.orgChild4Id], + 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, privilege: "NORMAL", }; } else if (privilege == "SPECIFIC") {