แก้ไขสิทธิ์ PARENT ให้เห็นข้อมูลทั้งหมดทุกหน่วยงาน #54
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m18s

This commit is contained in:
harid 2026-02-19 14:27:02 +07:00
parent da75287882
commit caacf07c76
14 changed files with 113 additions and 79 deletions

View file

@ -219,7 +219,8 @@ export class CommandController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -165,7 +165,8 @@ export class DevelopmentRequestController extends Controller {
data.child1 != undefined && data.child1 != null
? data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: data.child1,

View file

@ -1154,7 +1154,8 @@ export class EmployeePositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `posMaster.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -901,7 +901,8 @@ export class EmployeeTempPositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `posMaster.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -157,8 +157,8 @@ export class OrganizationDotnetController extends Controller {
condition = "orgRoot.ancestorDNA = :nodeId";
conditionParams = { nodeId: body.nodeId };
} else if (body.role === "PARENT") {
condition = "orgRoot.ancestorDNA = :nodeId AND current_holders.orgChild1 IS NOT NULL";
conditionParams = { nodeId: body.nodeId };
// condition = "orgRoot.ancestorDNA = :nodeId AND current_holders.orgChild1 IS NOT NULL";
// conditionParams = { nodeId: body.nodeId };
} else if (body.role === "NORMAL") {
switch (body.node) {
case 0:
@ -298,8 +298,8 @@ export class OrganizationDotnetController extends Controller {
condition = "orgRoot.ancestorDNA = :nodeId";
conditionParams = { nodeId: body.nodeId };
} else if (body.role === "PARENT") {
condition = "orgRoot.ancestorDNA = :nodeId AND current_holders.orgChild1 IS NOT NULL";
conditionParams = { nodeId: body.nodeId };
// condition = "orgRoot.ancestorDNA = :nodeId AND current_holders.orgChild1 IS NOT NULL";
// conditionParams = { nodeId: body.nodeId };
} else if (body.role === "NORMAL") {
switch (body.node) {
case 0:
@ -5743,7 +5743,7 @@ export class OrganizationDotnetController extends Controller {
},
) {
let typeCondition: any = {};
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
if (body.role === "CHILD" || /*body.role === "PARENT" ||*/ body.role === "BROTHER") {
if (body.role === "CHILD") {
switch (body.node) {
case 0:
@ -5785,7 +5785,8 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "BROTHER") {
}
else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
typeCondition = {
@ -5826,15 +5827,16 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "PARENT") {
typeCondition = {
orgRoot: {
ancestorDNA: body.nodeId,
},
orgChild1: Not(IsNull()),
};
}
} else if (body.role === "OWNER" || body.role === "ROOT") {
}
// else if (body.role === "PARENT") {
// typeCondition = {
// orgRoot: {
// ancestorDNA: body.nodeId,
// },
// orgChild1: Not(IsNull()),
// };
// }
} else if (body.role === "OWNER" || body.role === "ROOT" || body.role === "PARENT") {
switch (body.reqNode) {
case 0:
typeCondition = {
@ -6390,7 +6392,7 @@ export class OrganizationDotnetController extends Controller {
},
) {
let typeCondition: any = {};
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
if (body.role === "CHILD" || /*body.role === "PARENT" ||*/ body.role === "BROTHER") {
if (body.role === "CHILD") {
switch (body.node) {
case 0:
@ -6432,7 +6434,8 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "BROTHER") {
}
else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
typeCondition = {
@ -6473,15 +6476,16 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "PARENT") {
typeCondition = {
orgRoot: {
ancestorDNA: body.nodeId,
},
orgChild1: Not(IsNull()),
};
}
} else if (body.role === "OWNER" || body.role === "ROOT") {
}
// else if (body.role === "PARENT") {
// typeCondition = {
// orgRoot: {
// ancestorDNA: body.nodeId,
// },
// orgChild1: Not(IsNull()),
// };
// }
} else if (body.role === "OWNER" || body.role === "ROOT" || body.role === "PARENT") {
switch (body.reqNode) {
case 0:
typeCondition = {
@ -7800,7 +7804,7 @@ export class OrganizationDotnetController extends Controller {
},
) {
let typeCondition: any = {};
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
if (body.role === "CHILD" || /*body.role === "PARENT" ||*/ body.role === "BROTHER") {
if (body.role === "CHILD") {
switch (body.node) {
case 0:
@ -7832,7 +7836,8 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "BROTHER") {
}
else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
typeCondition = {
@ -7863,13 +7868,14 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "PARENT") {
typeCondition = {
rootDnaId: body.nodeId,
child1DnaId: Not(IsNull()),
};
}
} else if (body.role === "OWNER" || body.role === "ROOT") {
}
// else if (body.role === "PARENT") {
// typeCondition = {
// rootDnaId: body.nodeId,
// child1DnaId: Not(IsNull()),
// };
// }
} else if (body.role === "OWNER" || body.role === "ROOT" || body.role === "PARENT") {
switch (body.reqNode) {
case 0:
typeCondition = {
@ -8025,7 +8031,7 @@ export class OrganizationDotnetController extends Controller {
},
) {
let typeCondition: any = {};
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
if (body.role === "CHILD" || /*body.role === "PARENT" ||*/ body.role === "BROTHER") {
if (body.role === "CHILD") {
switch (body.node) {
case 0:
@ -8067,7 +8073,8 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "BROTHER") {
}
else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
typeCondition = {
@ -8108,15 +8115,16 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "PARENT") {
typeCondition = {
orgRoot: {
ancestorDNA: body.nodeId,
},
orgChild1: Not(IsNull()),
};
}
} else if (body.role === "OWNER" || body.role === "ROOT") {
}
// else if (body.role === "PARENT") {
// typeCondition = {
// orgRoot: {
// ancestorDNA: body.nodeId,
// },
// orgChild1: Not(IsNull()),
// };
// }
} else if (body.role === "OWNER" || body.role === "ROOT" || body.role === "PARENT") {
switch (body.reqNode) {
case 0:
typeCondition = {
@ -8369,7 +8377,7 @@ export class OrganizationDotnetController extends Controller {
},
) {
let typeCondition: any = {};
if (body.role === "CHILD" || body.role === "PARENT" || body.role === "BROTHER") {
if (body.role === "CHILD" || /*body.role === "PARENT" ||*/ body.role === "BROTHER") {
if (body.role === "CHILD") {
switch (body.node) {
case 0:
@ -8401,7 +8409,8 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "BROTHER") {
}
else if (body.role === "BROTHER") {
switch (body.node) {
case 0:
typeCondition = {
@ -8432,13 +8441,14 @@ export class OrganizationDotnetController extends Controller {
typeCondition = {};
break;
}
} else if (body.role === "PARENT") {
typeCondition = {
rootDnaId: body.nodeId,
child1DnaId: Not(IsNull()),
};
}
} else if (body.role === "OWNER" || body.role === "ROOT") {
}
// else if (body.role === "PARENT") {
// typeCondition = {
// rootDnaId: body.nodeId,
// child1DnaId: Not(IsNull()),
// };
// }
} else if (body.role === "OWNER" || body.role === "ROOT" || body.role === "PARENT") {
switch (body.reqNode) {
case 0:
typeCondition = {

View file

@ -734,8 +734,10 @@ export class PermissionController extends Controller {
};
} 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,

View file

@ -2390,7 +2390,8 @@ export class PositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? "posMaster.orgChild1Id IN (:...child1)"
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `posMaster.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 }
)

View file

@ -2267,7 +2267,8 @@ export class ProfileController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -6243,7 +6244,8 @@ export class ProfileController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -6630,7 +6632,8 @@ export class ProfileController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -8984,7 +8987,8 @@ export class ProfileController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -9507,7 +9511,8 @@ export class ProfileController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -151,7 +151,8 @@ export class ProfileEditController extends Controller {
data.child1 != undefined && data.child1 != null
? data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: data.child1,

View file

@ -150,7 +150,8 @@ export class ProfileEditEmployeeController extends Controller {
data.child1 != undefined && data.child1 != null
? data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: data.child1,

View file

@ -2888,7 +2888,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -3767,7 +3768,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -4325,7 +4327,8 @@ export class ProfileEmployeeController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -1105,7 +1105,8 @@ export class ProfileEmployeeTempController extends Controller {
_dataOrg.child1 != undefined && _dataOrg.child1 != null
? _dataOrg.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is ${_dataOrg.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holderTemps.orgChild1Id is ${_dataOrg.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _dataOrg.child1,
@ -1560,7 +1561,8 @@ export class ProfileEmployeeTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -2271,7 +2273,8 @@ export class ProfileEmployeeTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holderTemps.orgChild1Id IN (:...child1)`
: `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holderTemps.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)

View file

@ -133,7 +133,8 @@ export class ProfileSalaryTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -544,7 +545,8 @@ export class ProfileSalaryTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,

View file

@ -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,