modification mineur
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"validcheck":"Your data are valid",
|
||||
"typedoesnnotexistinschema":"This type in your propertie is not manage by Checkjson.js",
|
||||
"dataerrpropertie":"Check your data that not fit your schema rules propertie",
|
||||
"dataerrpropertiesrequired":"This propertie is required and not present in your data"
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"validcheck":"Your data are valid",
|
||||
"typedoesnnotexistinschema":"This type in your propertie is not manage by Checkjson.js",
|
||||
"dataerrpropertie":"Check your data that not fit your schema rules propertie",
|
||||
"dataerrpropertiesrequired":"This propertie is required and not present in your data",
|
||||
"externalrefnotload":"You have in your schema a relative sub schema, you have to load it before"
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"nationnamedesc":"Nom unique d'une nation dans un monde social",
|
||||
"nationnamedesclong":"Nom unique identifiant une nation dans le monde social créer par un maire d'une nouvelle ville avec un contrat sociale specifique",
|
||||
"nationnameinfo":"<p> Une nation posséde un nom unique, un contrat sociale (contracts/name.js) signé et validé par tous les maires des villes associées à cette nation </p>",
|
||||
"statusdesc":"Statut de la nation",
|
||||
"statusactive":"Nation active"
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"missingconf":"Il manque un smtp/sms valide pour {{tribe}} ou sur le serveur /conf.json",
|
||||
"missingdata":"Il manque des données obligatoire dans data {{#missingk}} {{.}} {{/missingk}}",
|
||||
"missingfile":"Le ou les fichiers suivants n'existent pas {{#missingfile}} {{.}} {{/missingfile}}",
|
||||
"errsendmail":"Une erreur s'est produite lors de l'envoie de l'email",
|
||||
"successfullsentemail":"Email correctement envoyé",
|
||||
"errsendsms":"Une erreur s'est produite lors de l'envoie du sms",
|
||||
"successfullsentsms":"Sms bien envoyé à {{To}}",
|
||||
"registersuccess":"Vous avez bien été enregistré pour être recontacté.",
|
||||
"formaterror":"Verifier vos données",
|
||||
"typekeyunknown":"Verifier typekey qui doit etre email ou telephone et qui est {{typeky}}",
|
||||
"destinnotallow":"Check {{destin}} that not exist"
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"alreadyexist": "An {{objectname}} object with the {{key}} key already exists with {{val}}",
|
||||
"doesnotexist": "The {{objectname}} object does not exist with {{key}}:{{val}}",
|
||||
"getschema": "Schema {{{conf.name}}}",
|
||||
"schemanotfound": "Schema not found in {{{schemaPath}}}",
|
||||
"pathnamedoesnotexist": "The directory does not exist {{{indexpath}}}",
|
||||
"objectfiledoesnotexist": "The file does not exist {{{objectpath}}}",
|
||||
"cudsuccessfull": "Update successful",
|
||||
"successfulcreatewithoutemail":"Create without sending an email",
|
||||
"successfulcreatewitemail":"Create you will receive an email",
|
||||
"missingprimarykey": "Missing a primary key apxid to store and identify objects",
|
||||
"unconsistencyapxidx": "The index {{name}} must contain at least {{apxid}} in objkey because keyval is not unique",
|
||||
"profilnotallow": "As {{person}} your profiles are not allow, this action is not authorized",
|
||||
"profilallow": "You are allowed for this action",
|
||||
"successreindex": "Object reindexed from items, your indexes are up to date",
|
||||
"indexexist":"The index exists",
|
||||
"typenotavailable":"The type: {{type}} for the propertie: {{propertie}} of the object:{{objectPathname}} is not taken into account for indexing",
|
||||
"objectslist":"List of objects from apxtri and {{tribe}}",
|
||||
"errordelete":"Sorry, unable to delete this account"
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"alreadyexist": "Un object {{objectname}} avec la clé {{key}} existe déjà avec {{val}}",
|
||||
"doesnotexist": "L'object {{objectname}} n'existe pas avec {{key}}:{{val}}",
|
||||
"getschema": "Schema {{{conf.name}}}",
|
||||
"schemanotfound": "Schema introuvable dans {{{schemaPath}}}",
|
||||
"pathnamedoesnotexist": "Le repertoire n'existe pas {{{indexpath}}}",
|
||||
"objectfiledoesnotexist": "Le fichier n'existe pas {{{objectpath}}}",
|
||||
"cudsuccessfull": "Mise à jour effectuée avec succés",
|
||||
"successfulcreatewithoutemail":"Créer sans envoi d'email",
|
||||
"successfulcreatewitemail":"Créer vous allez recevoir un email",
|
||||
"missingprimarykey": "Il manque une clé primaire apxid pour stocker et identifier les objects",
|
||||
"unconsistencyapxidx": "L'index {{name}} doit contenir en objkey au moins {{apxid}} car keyval n'est pas unique",
|
||||
"profilnotallow": "Vous n'avez pas le profil pour faire cette action.",
|
||||
"profilallow": "Vous avez été authorisé à faire cette action",
|
||||
"successreindex": "Objet reindexé à partir des items, vos index sont à jour",
|
||||
"indexexist":"L'indexe existe",
|
||||
"typenotavailable":"Le type: {{type}} pour la propertie : {{propertie}} de l'object :{{objectPathname}} n'est pas pris en compte pour l'indexation",
|
||||
"objectslist":"Liste des objects d'apxtri et de {{tribe}}",
|
||||
"errordelete":"Desolé impossible de supprimer ce compte"
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"aliasexist":"This alias {{alias]} exist",
|
||||
"aliasdoesnotexist":"This alias {{alias}} does not exist ",
|
||||
"personexist":"This person {{alias}} exist for {{tribeid}}",
|
||||
"successfullcreate": "This identity {{alias}} creation was successfull. {{#withemail}} An email was sent to {{email}}, if you do not receive it, please download your keys before living this page.{{/withemail}}",
|
||||
"successfulluppdate": "Your alias as a Person is now update into {{tribeid}}",
|
||||
"tribedoesnotexist": "Your tribe {{tribeid}} does not exist in this town"
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
{ "invalidalias":"Alias doit être composé exclusivement de minuscules ou de chiffres et contenir au moins 4 caracteres",
|
||||
"aliasexist": "Cet alias {{alias}} existe",
|
||||
"emailerr": "Verifier votre email {{email}}",
|
||||
"aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée",
|
||||
"aliasdoesnotexist": "Cet alias {{alias}} n'existe pas",
|
||||
"personexist": "Cette personne {{alias}} existe pour {{tribeid}}",
|
||||
"persondoesnotexist": "Cette personne {{alias}} n'existe pas pour {{tribeid}}",
|
||||
"successfulcreate":"Votre identité {{alias}} a été créee à partir de vos clés.{{#emailsent}} Un email a été envoyé à {{email}}, si vous ne le recevez pas, veuillez télécharger vos clés avant de quitter cette page.{{/emailsent}} {{#emailerror}}Un problème lors de l'envoi sur {{email}} s'est produit. Veuillez télécharger vos clés avant de quitter cette page.{{/emailerror}}<br>{{#createperson}}Félicitation Votre compte est ouvert chez {{tribe}}. {{/createperson}} {{#errorperson}}Attention votre identité n'a pas été associée à {{tribe}}. Vous pourrez rejoindre {{tribe}} dans l'écran suivant. {{/errorperson}}",
|
||||
"successfulluppdate": "Votre alias en tant que Personne est maintenant mis à jour dans {{tribeid}}",
|
||||
"errcreate": "Desolé, un probléme inconnu empeche la creation",
|
||||
"logout": "Votre token a été supprimé du server",
|
||||
"emailnotfound":"Auncune identité n'a été enregistrée sur {{tribe}} avec l'email {{email}} ",
|
||||
"recoveryemailsent":"Votre email: {{email}} dispose de {{nbalias}} identitées sur {{tribe}}, nous avons envoyés {{nbsent}} messages sans problèmes.",
|
||||
"templatedoesnotexist":"Le template {{tplfile}} n'existe pas"
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"actionmissing":"L'action {{data.action}} n'existe pas pour la tribut {{data.tribe}}."
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"errrequest": "Backend seems not available",
|
||||
"unconsistentpgp": "Your keys are not consistent {{err}}",
|
||||
"missingheader": "Some header miss to have a valid request: {{#missinghearder}} {{.}} {{/missingheader}}",
|
||||
"tribeiddoesnotexist": "Header xtribe: {{xtribe}} does not exist in this town you cannot access",
|
||||
"unconsistentcleartextmessage":"Your xhash: {{xhash}} is not consistent as a clear msg {{{clearmsg}}}",
|
||||
"authenticated": "Your alias: {{{xalias}}} is authenticated",
|
||||
"notauthenticated": "Your alias: {{xalias}} is not authenticated {{^xaliasexists}} and this alias does not exist !{{/xaliasexists}}",
|
||||
"signaturefailled": "Your signature is not valid for your alias."
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"errrequest": "Le serveur ne semble pas répondre",
|
||||
"unconsistentpgp": "Vos clés ne sont pas conforme {{err}}",
|
||||
"missingheader": "Certains en-têtes manquent pour avoir une requête valide : {{#missinghearder}} {{.}} {{/missingheader}}",
|
||||
"tribeiddoesnotexist": "L'en-tête xtribe : {{xtribe}} n'existe pas dans cette ville, vous ne pouvez pas y accéder",
|
||||
"unconsistentcleartextmessage":"Votre xhash: {{xhash}} n'est pas lisible par openpgp.js avec le clearmsg: {{{clearmsg}}}",
|
||||
"authenticated": "Votre alias {{{xalias}}} est authentifié",
|
||||
"notauthenticated": "Votre alias : {{xalias}} n'est pas authentifié {{^xaliasexists}} et cet alias n'existe pas !{{/xaliasexists}}",
|
||||
"signaturefailled": "Desolé votre signature n'est pas valide pour cet alias."
|
||||
}
|
@@ -160,14 +160,14 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
|
||||
const replacelg = (data) => {
|
||||
// data.en version schema de base, data.fr version schema traduite
|
||||
Object.keys(data.lg).forEach((k) => {
|
||||
console.log(k);
|
||||
//console.log(k);
|
||||
if (data.lg[k].title) data.en[k].title = data.lg[k].title;
|
||||
if (data.lg[k].description)
|
||||
data.en[k].description = data.lg[k].description;
|
||||
if (data.lg.properties) {
|
||||
console.log("properties");
|
||||
console.log(data.en.properties);
|
||||
console.log(data.lg.properties);
|
||||
//console.log("properties");
|
||||
//console.log(data.en.properties);
|
||||
//console.log(data.lg.properties);
|
||||
const res = replacelg({
|
||||
en: data.en.properties,
|
||||
lg: data.lg.properties,
|
||||
@@ -184,12 +184,13 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
|
||||
// lance requete http pour recuperer le schema avec un await axios
|
||||
} else {
|
||||
schemaPath = `../../${schemaPath}`;
|
||||
if (log)
|
||||
/*if (log)
|
||||
console.log(
|
||||
currentmod,
|
||||
"resolve path schemaPath:",
|
||||
path.resolve(schemaPath)
|
||||
);
|
||||
*/
|
||||
if (!fs.existsSync(schemaPath)) {
|
||||
return {};
|
||||
} else {
|
||||
@@ -234,7 +235,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
|
||||
(optionstype = "idx");
|
||||
optionsfile = path.resolve(`../../${propertie.options["$ref"]}.json`);
|
||||
}
|
||||
if (log) console.log(currentmod, "Lien vers options:", optionsfile);
|
||||
//if (log) console.log(currentmod, "Lien vers options:", optionsfile);
|
||||
if (!fs.existsSync(optionsfile)) {
|
||||
propertie.msg = "missingref";
|
||||
return propertie;
|
||||
@@ -250,7 +251,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
|
||||
return propertie;
|
||||
};
|
||||
|
||||
if (log) console.log(currentmod, `${objectPathname}/conf.json`);
|
||||
//if (log) console.log(currentmod, `${objectPathname}/conf.json`);
|
||||
const res = {
|
||||
status: 200,
|
||||
ref: "Odmdb",
|
||||
@@ -437,7 +438,7 @@ Odmdb.search = (objectPathname, objsearch, role) => {
|
||||
role.xprofils = role.xprofils.filter((e) => e !== "owner");
|
||||
}
|
||||
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];
|
||||
} else {
|
||||
//ifields[f] = "unauthorized";
|
||||
@@ -499,72 +500,6 @@ Odmdb.r = (objectPathname, apxid, role) => {
|
||||
return { status: 200, ref: "Odmdb", msg: "profilallow", data };
|
||||
};
|
||||
|
||||
/**
|
||||
* To get an array of item (itm) per primarykey with a list of field
|
||||
* Object are store in objectPath/objectName/conf.json contain
|
||||
*
|
||||
* @objectPathname where object are store (where /object/conf.json indicate where the schema is)
|
||||
* @uuidprimarykeyList list of uuid requested
|
||||
* @role {xalias,xprofiles} allow to get accessright come from header
|
||||
* @propertiesfilter (optionnal) key to return for each object (if undefined then return all)
|
||||
* @Return {status:200; data:{uuid:{data filter by @propertiesfilter},uuid:"notfound"}}
|
||||
|
||||
ASUP doit être gerer au niveau des view des index
|
||||
|
||||
|
||||
*/
|
||||
Odmdb.ASUPreads = (objectPathname, apxidlist, role, propertiesfilter) => {
|
||||
const res = { status: 200, data: {} };
|
||||
const getschema = Odmdb.Schema(objectPathname, true);
|
||||
if (getschema.status != 200) return getschema;
|
||||
// Test if readable at least if owner
|
||||
role.xprofils.push("owner");
|
||||
const accessright = (Odmdb.accessright =
|
||||
(getschema.data.schema.apxaccessright, role.xprofils));
|
||||
if (!accessright.R) {
|
||||
return {
|
||||
status: 403,
|
||||
ref: "Odmdb",
|
||||
msg: "profilnotallow",
|
||||
data: { crud: "R", accessright },
|
||||
};
|
||||
}
|
||||
apxidlist.forEach((id) => {
|
||||
if (fs.existsSync(`${objectPathname}/itm/${id}.json`)) {
|
||||
const objectdata = fs.readJsonSync(`${objectPathname}/itm/${id}.json`);
|
||||
if (objectdata.owner && objectdata.owner == role.xalias) {
|
||||
if (!role.xprofils.includes("owner")) role.xprofils.push("owner");
|
||||
} else {
|
||||
if (role.xprofils.includes("owner"))
|
||||
role.xprofils = role.xprofils.filter((e) => e !== "owner");
|
||||
}
|
||||
const accessright = Odmdb.accessright(
|
||||
getschema.data.schema.apxaccessright,
|
||||
role
|
||||
);
|
||||
if (!accessright.R) {
|
||||
res.data[id] = "forbiden";
|
||||
} else {
|
||||
let newpropertiesfilter = Object.keys(objectdata);
|
||||
if (accessright.R.length > 0) {
|
||||
const setaccess = new Set(accessright.R);
|
||||
if (!propertiesfilter) propertiesfilter = Object.keys(objectdata);
|
||||
newpropertiesfilter = propertiesfilter.filter((f) =>
|
||||
setaccess.has(f)
|
||||
);
|
||||
}
|
||||
const objinfo = {};
|
||||
newpropertiesfilter.forEach((k) => {
|
||||
if (objectdata[k]) objinfo[k] = objectdata[k];
|
||||
});
|
||||
res.data[id] = objinfo;
|
||||
}
|
||||
} else {
|
||||
res.data[id] = "notfound";
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
/**
|
||||
* Convert profils in accessright
|
||||
* @param {*} apxaccessright from schema object {profilname:{R}}
|
||||
@@ -771,7 +706,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
||||
currentmod,
|
||||
`${objectPathname}/itm/${chkdata.data.apxid}.json`
|
||||
);
|
||||
if (log) console.log(currentmod, chkdata.data.itm);
|
||||
//if (log) console.log(currentmod, chkdata.data.itm);
|
||||
fs.outputJSONSync(
|
||||
`${objectPathname}/itm/${chkdata.data.apxid}.json`,
|
||||
chkdata.data.itm
|
||||
@@ -802,7 +737,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
||||
*
|
||||
*/
|
||||
Odmdb.runidx = (objectPathname, schema) => {
|
||||
if (log) console.log(currentmod, `idx for ${objectPathname}`);
|
||||
//if (log) console.log(currentmod, `idx for ${objectPathname}`);
|
||||
if (!schema || !schema.apxid) {
|
||||
const getschema = Odmdb.Schema(objectPathname, true);
|
||||
if (getschema.status != 200) return getschema;
|
||||
@@ -831,7 +766,7 @@ Odmdb.runidx = (objectPathname, schema) => {
|
||||
const itm = fs.readJSONSync(i);
|
||||
Object.keys(ventil).forEach((n) => {
|
||||
let keep = true;
|
||||
console.log(`Index name: ${n}`)
|
||||
//console.log(`Index name: ${n}`)
|
||||
if (ventil[n].filter != "") {
|
||||
try {
|
||||
keep = eval(ventil[n].filter);
|
||||
@@ -872,7 +807,7 @@ Odmdb.runidx = (objectPathname, schema) => {
|
||||
ventil[n].keyvaltype == "string"
|
||||
? [itm[ventil[n].keyval]]
|
||||
: itm[ventil[n].keyval];
|
||||
console.log(ventil[n].keyval, itm[ventil[n].keyval], itm)
|
||||
//console.log(ventil[n].keyval, itm[ventil[n].keyval], itm)
|
||||
// itm[ventil[n].keyval] is an array
|
||||
listval.forEach((val) => {
|
||||
if (!ventil[n].data[val]) ventil[n].data[val] = [];
|
||||
@@ -886,8 +821,8 @@ Odmdb.runidx = (objectPathname, schema) => {
|
||||
itm[ventil[n].keyval.split(".")[0]]
|
||||
) {
|
||||
let itmval = JSON.parse(JSON.stringify(itm));
|
||||
if (log) console.log(currentmod, ventil[n].keyval);
|
||||
if (log) console.log(currentmod, itmval);
|
||||
//if (log) console.log(currentmod, ventil[n].keyval);
|
||||
//if (log) console.log(currentmod, itmval);
|
||||
ventil[n].keyval
|
||||
.split(".")
|
||||
.forEach((i) => (itmval = itmval[i] ? itmval[i] : null));
|
||||
@@ -1053,7 +988,7 @@ Odmdb.ASUPidxfromitm = (
|
||||
}
|
||||
return { status: 200, ref: "Odmdb", msg: "successreindex", data: {} };
|
||||
};
|
||||
Odmdb.updatefromidxall = (objectname, idxname, data, lastupdate) => {
|
||||
Odmdb.ASUPupdatefromidxall = (objectname, idxname, data, lastupdate) => {
|
||||
/**
|
||||
* Update all itm of objectname from index idx/idxname with data
|
||||
* if itm exist in local and not in data then /ojectname/conf.json.lastupdate = now
|
||||
|
@@ -19,7 +19,6 @@ const log = conf.api.activelog.includes(currentmod);
|
||||
*/
|
||||
const Pagans = {};
|
||||
|
||||
|
||||
/**
|
||||
* Remove authentification token after a logout
|
||||
* @param {string} alias
|
||||
@@ -41,6 +40,61 @@ Pagans.logout = (alias, tribe, xdays, xhash) => {
|
||||
return { status: 200, ref: "Pagans", msg: "logout" };
|
||||
};
|
||||
|
||||
/**
|
||||
* Recovery keys by email or by alias and send one mail per alias
|
||||
* @Param emailalias (2 options email or alias)
|
||||
* @Param tribe and existing tribe on this serveur
|
||||
* @Param search a text string to looking for (as email or as alias)
|
||||
* @Param lg language to send email
|
||||
*/
|
||||
|
||||
Pagans.keyrecovery = (emailalias, tribe, search, lg) => {
|
||||
if (!["email", "alias"].includes(emailalias)) {
|
||||
return {
|
||||
status: 406,
|
||||
ref: "Pagans",
|
||||
msg: "emailaliasnotemailoralias",
|
||||
data: {},
|
||||
};
|
||||
}
|
||||
let emaillist = [];
|
||||
if (emailalias == "email") {
|
||||
search = search.toLowerCase();
|
||||
const idxreco = `../../${tribe}/objects/persons/idx/emailrecovery_alias.json`;
|
||||
if (fs.existsSync(idxreco)) {
|
||||
const emailreco = fs.readJSONSync(idxreco);
|
||||
const listalias = emailreco[search] ? emailreco[search] : [];
|
||||
listalias.forEach((a) => {
|
||||
emaillist.push({ alias: a, tribe, lg });
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const personpath = `../../${tribe}/objects/persons/itm/${search}.json`;
|
||||
if (fs.existsSync(personpath)) {
|
||||
emaillist.push({ alias: search, tribe, lg });
|
||||
}
|
||||
}
|
||||
emaillist.forEach((e) => {
|
||||
console.log(e);
|
||||
//const ret = Pagans.sendmailkey(e);
|
||||
});
|
||||
|
||||
if (emaillist.length > 0) {
|
||||
return {
|
||||
status: 200,
|
||||
ref: "Pagans",
|
||||
msg: "recoveryemailsent",
|
||||
data: { numberemailsent: emaillist.length },
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: 404,
|
||||
ref: "Pagans",
|
||||
msg: "recoveryemailnotfound",
|
||||
data: { tribe },
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} alias a alias that exist or not
|
||||
* @return {object} { status: 200, ref:"pagans",msg:"aliasexist",data: { alias, publicKey } }
|
||||
|
Reference in New Issue
Block a user