add permission brother
This commit is contained in:
parent
878e52b1b0
commit
3a4e16deb0
5 changed files with 35 additions and 21 deletions
|
|
@ -2036,7 +2036,7 @@ export class OrganizationController extends Controller {
|
|||
_data.child2 = [holder.orgChild2Id];
|
||||
_data.child3 = [holder.orgChild3Id];
|
||||
_data.child4 = [holder.orgChild4Id];
|
||||
} else if (_privilege.privilege == "CHILD") {
|
||||
} else if (_privilege.privilege == "CHILD" || _privilege.privilege == "BROTHER") {
|
||||
const holder = profile.current_holders.find((x) => x.orgRevisionId === id);
|
||||
if (!holder) return;
|
||||
_data.root = [holder.orgRootId];
|
||||
|
|
@ -6174,7 +6174,7 @@ export class OrganizationController extends Controller {
|
|||
_data.child2 = [holder.orgChild2Id];
|
||||
_data.child3 = [holder.orgChild3Id];
|
||||
_data.child4 = [holder.orgChild4Id];
|
||||
} else if (_privilege.privilege == "CHILD") {
|
||||
} else if (_privilege.privilege == "CHILD" || _privilege.privilege == "BROTHER") {
|
||||
const holder = profile.current_holders.find((x) => x.orgRevisionId === id);
|
||||
if (!holder) return;
|
||||
_data.root = [holder.orgRootId];
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
) {
|
||||
let condition = "1=1";
|
||||
let conditionParams = {};
|
||||
if (body.role === "CHILD") {
|
||||
if (body.role === "CHILD" || body.role === "BROTHER") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
condition = "orgRoot.ancestorDNA = :nodeId";
|
||||
|
|
@ -198,7 +198,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
) {
|
||||
let condition = "1=1";
|
||||
let conditionParams = {};
|
||||
if (body.role === "CHILD") {
|
||||
if (body.role === "CHILD" || body.role === "BROTHER") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
condition = "orgRoot.ancestorDNA = :nodeId";
|
||||
|
|
@ -4399,8 +4399,8 @@ export class OrganizationDotnetController extends Controller {
|
|||
},
|
||||
) {
|
||||
let typeCondition: any = {};
|
||||
if (body.role === "CHILD" || body.role === "PARENT") {
|
||||
if (body.role === "CHILD") {
|
||||
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
|
||||
if (body.role === "CHILD" || body.role === "BROTHER") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
|
|
@ -4441,16 +4441,14 @@ export class OrganizationDotnetController extends Controller {
|
|||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (body.role === "PARENT") {
|
||||
} else if (body.role === "PARENT") {
|
||||
typeCondition = {
|
||||
orgRoot: {
|
||||
ancestorDNA: body.nodeId
|
||||
ancestorDNA: body.nodeId,
|
||||
},
|
||||
orgChild1: Not(IsNull()),
|
||||
};
|
||||
}
|
||||
|
||||
} else if (body.role === "OWNER" || body.role === "ROOT") {
|
||||
switch (body.reqNode) {
|
||||
case 0:
|
||||
|
|
@ -5005,8 +5003,8 @@ export class OrganizationDotnetController extends Controller {
|
|||
},
|
||||
) {
|
||||
let typeCondition: any = {};
|
||||
if (body.role === "CHILD" || body.role === "PARENT") {
|
||||
if (body.role === "CHILD") {
|
||||
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
|
||||
if (body.role === "CHILD" || body.role === "BROTHER") {
|
||||
switch (body.node) {
|
||||
case 0:
|
||||
typeCondition = {
|
||||
|
|
@ -5043,23 +5041,18 @@ export class OrganizationDotnetController extends Controller {
|
|||
},
|
||||
};
|
||||
break;
|
||||
case null:
|
||||
typeCondition = {};
|
||||
break;
|
||||
default:
|
||||
typeCondition = {};
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (body.role === "PARENT") {
|
||||
} else if (body.role === "PARENT") {
|
||||
typeCondition = {
|
||||
orgRoot: {
|
||||
ancestorDNA: body.nodeId
|
||||
ancestorDNA: body.nodeId,
|
||||
},
|
||||
orgChild1: Not(IsNull()),
|
||||
};
|
||||
}
|
||||
|
||||
} else if (body.role === "OWNER" || body.role === "ROOT") {
|
||||
switch (body.reqNode) {
|
||||
case 0:
|
||||
|
|
|
|||
|
|
@ -748,6 +748,14 @@ export class PermissionController extends Controller {
|
|||
child3: node >= 3 ? [x.orgChild3Id] : null,
|
||||
child4: node >= 4 ? [x.orgChild4Id] : null,
|
||||
};
|
||||
} else if (privilege == "BROTHER") {
|
||||
data = {
|
||||
// root: node >= 0 ? null : 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,
|
||||
};
|
||||
} else if (privilege == "NORMAL") {
|
||||
data = {
|
||||
root: [x.orgRootId],
|
||||
|
|
|
|||
|
|
@ -2525,7 +2525,11 @@ export class PositionController extends Controller {
|
|||
}),
|
||||
);
|
||||
|
||||
if (_data.privilege === "NORMAL" || _data.privilege === "CHILD") {
|
||||
if (
|
||||
_data.privilege === "NORMAL" ||
|
||||
_data.privilege === "CHILD" ||
|
||||
_data.privilege === "BROTHER"
|
||||
) {
|
||||
//PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
|
||||
const nextChildMap: any = {
|
||||
//เอาไวเช็ค CHILD ถัดไป
|
||||
|
|
@ -2539,7 +2543,7 @@ export class PositionController extends Controller {
|
|||
if (Array.isArray(childValue) && childValue.some((item) => item != null)) {
|
||||
return new HttpSuccess({ data: [], total: 0 });
|
||||
}
|
||||
} else if (_data.privilege === "CHILD") {
|
||||
} else if (_data.privilege === "CHILD" || _data.privilege === "BROTHER") {
|
||||
const higherChildChecks = [
|
||||
{ type: [0], child: _data.child1, next: _data.child2 },
|
||||
{ type: [0, 1], child: _data.child2, next: _data.child3 },
|
||||
|
|
|
|||
|
|
@ -112,6 +112,15 @@ class CheckAuth {
|
|||
child4: node >= 4 ? [x.orgChild4Id] : null,
|
||||
privilege: "CHILD",
|
||||
};
|
||||
} else if (privilege == "BROTHER") {
|
||||
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,
|
||||
privilege: "BROTHER",
|
||||
};
|
||||
} else if (privilege == "NORMAL") {
|
||||
data = {
|
||||
root: [x.orgRootId],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue