forked from apxtri/apxtri
fix get itm accessright
This commit is contained in:
parent
3e8c5b3d74
commit
b58e31c5c2
@ -438,7 +438,10 @@ Odmdb.search = (objectPathname, objsearch, role) => {
|
|||||||
role.xprofils = role.xprofils.filter((e) => e !== "owner");
|
role.xprofils = role.xprofils.filter((e) => e !== "owner");
|
||||||
}
|
}
|
||||||
objsearch.fields.forEach((f) => {
|
objsearch.fields.forEach((f) => {
|
||||||
if (accessright.R && (accessright.R.length == 0 || accessright.R.includes(f))) {
|
if (
|
||||||
|
accessright.R &&
|
||||||
|
(accessright.R.length == 0 || accessright.R.includes(f))
|
||||||
|
) {
|
||||||
ifields[f] = itm[f];
|
ifields[f] = itm[f];
|
||||||
} else {
|
} else {
|
||||||
//ifields[f] = "unauthorized";
|
//ifields[f] = "unauthorized";
|
||||||
@ -494,9 +497,15 @@ Odmdb.r = (objectPathname, apxid, role) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const data = {};
|
const data = {};
|
||||||
accessright.R.forEach((p) => {
|
const allowedkey =
|
||||||
|
accessright.R.length == 0
|
||||||
|
? Object.keys(getschema.data.schema.properties)
|
||||||
|
: accessright.R;
|
||||||
|
|
||||||
|
allowedkey.forEach((p) => {
|
||||||
data[p] = itm[p];
|
data[p] = itm[p];
|
||||||
});
|
});
|
||||||
|
|
||||||
return { status: 200, ref: "Odmdb", msg: "profilallow", data };
|
return { status: 200, ref: "Odmdb", msg: "profilallow", data };
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -663,7 +672,10 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
|||||||
//Manage base64 case image to convert ans store in webp
|
//Manage base64 case image to convert ans store in webp
|
||||||
if (k.includes("imgbase64_") && itmtostore[k] != "") {
|
if (k.includes("imgbase64_") && itmtostore[k] != "") {
|
||||||
fs.ensureDirSync(`${objectPathname}/img/`);
|
fs.ensureDirSync(`${objectPathname}/img/`);
|
||||||
const imgb64 = itmtostore[k].replace(/^data:image\/(png|png|gif|bmp|jpg|jpeg);base64,/,"");//.replace(/\+/g," ");
|
const imgb64 = itmtostore[k].replace(
|
||||||
|
/^data:image\/(png|png|gif|bmp|jpg|jpeg);base64,/,
|
||||||
|
""
|
||||||
|
); //.replace(/\+/g," ");
|
||||||
const extension = itmtostore[k].split(";base64,")[0].split("/")[1];
|
const extension = itmtostore[k].split(";base64,")[0].split("/")[1];
|
||||||
const newk = k.split("_").slice(1).join("_");
|
const newk = k.split("_").slice(1).join("_");
|
||||||
const filenameimg = `/img/${
|
const filenameimg = `/img/${
|
||||||
@ -682,7 +694,9 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
|||||||
//const buf = Buffer.from(itmtostore[k], 'base64');
|
//const buf = Buffer.from(itmtostore[k], 'base64');
|
||||||
//const imgwebp = await webp.bufferToWebp(buf);
|
//const imgwebp = await webp.bufferToWebp(buf);
|
||||||
//@TODO use sharp to resize img with attribut sizeHW in propertie
|
//@TODO use sharp to resize img with attribut sizeHW in propertie
|
||||||
fs.writeFileSync(`${objectPathname}/${filenameimg}`, imgb64,{encoding:"base64"});
|
fs.writeFileSync(`${objectPathname}/${filenameimg}`, imgb64, {
|
||||||
|
encoding: "base64",
|
||||||
|
});
|
||||||
itmtostore[k] = "";
|
itmtostore[k] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user