1
0
forked from apxtri/apxtri

fix bug case 0 jobstepposition in post

This commit is contained in:
philc 2024-10-02 17:29:20 +02:00
parent 2ba6787673
commit 053b45c81c

View File

@ -524,10 +524,11 @@ Odmdb.accessright = (apxaccessrights, role, properties) => {
//if (log) console.log(currentmod,"properties",properties) //if (log) console.log(currentmod,"properties",properties)
const accessright = {}; const accessright = {};
console.log(); console.log();
role.xprofils.forEach(p => { role.xprofils.forEach((p) => {
if (apxaccessrights[p]) { if (apxaccessrights[p]) {
Object.keys(apxaccessrights[p]).forEach(act => { Object.keys(apxaccessrights[p]).forEach((act) => {
if (apxaccessrights[p][act].length===0) apxaccessrights[p][act]=properties; if (apxaccessrights[p][act].length === 0)
apxaccessrights[p][act] = properties;
if (!accessright[act]) { if (!accessright[act]) {
accessright[act] = apxaccessrights[p][act]; accessright[act] = apxaccessrights[p][act];
} else { } else {
@ -535,7 +536,7 @@ Odmdb.accessright = (apxaccessrights, role, properties) => {
...new Set([...accessright[act], ...apxaccessrights[p][act]]), ...new Set([...accessright[act], ...apxaccessrights[p][act]]),
]; ];
} }
}) });
} }
}); });
return accessright; return accessright;
@ -622,9 +623,10 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
role, role,
Object.keys(getschema.data.schema.properties) Object.keys(getschema.data.schema.properties)
); );
Object.keys(accessright).forEach(act=>{ Object.keys(accessright).forEach((act) => {
if (accessright[act].length===0) accessright[act]=Object.keys(getschema.data.schema.properties) if (accessright[act].length === 0)
}) accessright[act] = Object.keys(getschema.data.schema.properties);
});
if (log) console.log(currentmod, "Accessright to: ", accessright); if (log) console.log(currentmod, "Accessright to: ", accessright);
if ( if (
(crud == "C" && !accessright.C) || (crud == "C" && !accessright.C) ||
@ -666,7 +668,12 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
//console.log(accessright) //console.log(accessright)
accessright.U.forEach(async (p) => { accessright.U.forEach(async (p) => {
// check this propertie exist in the requested update itm // check this propertie exist in the requested update itm
if (itm[p] && itm[p] !== "") itmtostore[p] = itm[p]; const testvaliditmupdate =
itm[p] === 0 ||
(itm[p] &&
((typeof itm[p] === "string" && itm[p].trim() !== "") ||
typeof itm[p] !== "string"));
if (testvaliditmupdate) itmtostore[p] = itm[p];
}); });
itmtostore.dt_update = dayjs().toISOString(); itmtostore.dt_update = dayjs().toISOString();
} }
@ -676,13 +683,18 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
); );
accessright.C.forEach(async (p) => { accessright.C.forEach(async (p) => {
// check this propertie exist in the requested update itm // check this propertie exist in the requested update itm
if (itm[p] && itm[p] !== "") itmtostore[p] = itm[p]; const testvaliditmcreate =
itm[p] === 0 ||
(itm[p] &&
((typeof itm[p] === "string" && itm[p].trim() !== "") ||
typeof itm[p] !== "string"));
if (testvaliditmcreate) itmtostore[p] = itm[p];
}); });
itmtostore.dt_create = dayjs().toISOString(); itmtostore.dt_create = dayjs().toISOString();
} }
Object.keys(itmtostore).forEach((k) => { Object.keys(itmtostore).forEach((k) => {
// remove empty itmtostore in case they are => // remove empty itmtostore in case they are =>
console.log(k, itmtostore[k], itmtostore[k] === ""); //console.log(k, itmtostore[k], itmtostore[k] === "");
if (itmtostore[k] === "") delete itmtostore[k]; if (itmtostore[k] === "") delete itmtostore[k];
}); });