fix brother privilage

This commit is contained in:
Adisak 2025-12-19 13:58:40 +07:00
parent 18ae347122
commit 4479507ae8

View file

@ -237,7 +237,7 @@ export class OrganizationDotnetController extends Controller {
) { ) {
let condition = "1=1"; let condition = "1=1";
let conditionParams = {}; let conditionParams = {};
if (body.role === "CHILD" || body.role === "BROTHER") { if (body.role === "CHILD") {
switch (body.node) { switch (body.node) {
case 0: case 0:
condition = "orgRoot.ancestorDNA = :nodeId"; condition = "orgRoot.ancestorDNA = :nodeId";
@ -259,6 +259,28 @@ export class OrganizationDotnetController extends Controller {
break; break;
} }
conditionParams = { nodeId: body.nodeId }; conditionParams = { nodeId: body.nodeId };
} else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
condition = "orgRoot.ancestorDNA = :nodeId";
break;
case 1:
condition = "orgRoot.ancestorDNA = :nodeId";
break;
case 2:
condition = "orgChild1.ancestorDNA = :nodeId";
break;
case 3:
condition = "orgChild2.ancestorDNA = :nodeId";
break;
case 4:
condition = "orgChild3.ancestorDNA = :nodeId";
break;
default:
condition = "1=1";
break;
}
conditionParams = { nodeId: body.nodeId };
} else if (body.role === "ROOT") { } else if (body.role === "ROOT") {
condition = "orgRoot.ancestorDNA = :nodeId"; condition = "orgRoot.ancestorDNA = :nodeId";
conditionParams = { nodeId: body.nodeId }; conditionParams = { nodeId: body.nodeId };