add msg in case unconsistent key
This commit is contained in:
@@ -24,6 +24,48 @@ Notifications.get = (alias, tribeId) => {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register an typekey(email) or (phone) key into mailinglist for a tribe
|
||||
*
|
||||
*/
|
||||
Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
|
||||
key = key.toLowerCase();
|
||||
if (!Checkjson.testformat(key, typekey))
|
||||
return {
|
||||
status: 400,
|
||||
ref: "Notifications",
|
||||
msg: "formaterreur",
|
||||
data: { fielderr: typekey, format: typekey },
|
||||
};
|
||||
const destin = `../../../nationchains/tribes/${tribe}/contacts/${typecontact}_${mlist}.json`;
|
||||
const filestorage = fs.existsSync(destin) ? fs.readJsonSync(destin) : {};
|
||||
if (filestorage[key]) {
|
||||
filestorage[key].dt_update = dayjs().toISOString();
|
||||
if (!filestorage[key].srckeys.includes(srckey))
|
||||
filestorage[key].srckeys.push(srckey);
|
||||
if (!filestorage[key].uuids.includes(uuid))
|
||||
filestorage[key].uuids.push(uuid);
|
||||
}else{
|
||||
filestorage[key].dt_create=dayjs().toISOString();
|
||||
filestorage[key].srckeys=[srckey];
|
||||
filestorage[key].uuids=[uuid]
|
||||
}
|
||||
fs.outputJSONSync(destin, filestorage);
|
||||
return {status:200,ref:"Notifications",msg:"register",data:{key, typekey, tribe, mlist, srckey, uuid}}
|
||||
}
|
||||
/**
|
||||
* Unsubscribe an eamil or phone from a mailinglist for a tribe
|
||||
*/
|
||||
Notifications.unsubscribefromlist = (body, header) => {
|
||||
|
||||
}
|
||||
/**
|
||||
* Message to send to an alias from an anonymous or not
|
||||
*/
|
||||
Notifications.sendcontact = (body, header) => {
|
||||
|
||||
}
|
||||
Notifications.sendsms = async (data, tribeId) => {
|
||||
/**
|
||||
* Never use need wallet in mailjet to test
|
||||
@@ -172,7 +214,7 @@ Notifications.sendmail = async (data, tribe) => {
|
||||
let confsmtp = conf.smtp;
|
||||
const conftribfile = `../nationchains/tribes/itm/${tribe}.json`;
|
||||
if (fs.existsSync(conftribfile)) {
|
||||
const conftrib = fs.readJSONSync(conftribfile);
|
||||
const conftrib = fs.readJSONSync(conftribfile);
|
||||
confsmtp = conftrib.smtp;
|
||||
if (!data.from) data.from = conftrib.emailcontact;
|
||||
}
|
||||
@@ -181,12 +223,12 @@ Notifications.sendmail = async (data, tribe) => {
|
||||
const transporter = await nodemailer.createTransport(confsmtp);
|
||||
//@todo add attachments management
|
||||
if (data.filelist) {
|
||||
data.attachments=[];
|
||||
data.attachments = [];
|
||||
let missingfile = [];
|
||||
data.filelist.forEach((fo) => {
|
||||
if (fs.existsSync(fo.pathfile)){
|
||||
|
||||
}else{ missingfile.push(fo.pathfile);}
|
||||
if (fs.existsSync(fo.pathfile)) {
|
||||
|
||||
} else { missingfile.push(fo.pathfile); }
|
||||
});
|
||||
if (missingfile.lenght > 0)
|
||||
return {
|
||||
|
@@ -299,15 +299,15 @@ Odmdb.r = (objectPathname, apxid, role) => {
|
||||
return {
|
||||
status: 403,
|
||||
ref: "Odmdb",
|
||||
msg: "forbidden",
|
||||
data: { person: apxid },
|
||||
msg: "profilnotallow",
|
||||
data: { person: apxid, },
|
||||
};
|
||||
}
|
||||
const data = {};
|
||||
accessright.R.forEach((p) => {
|
||||
data[p] = itm[p];
|
||||
});
|
||||
return { status: 200, ref: "Odmdb", msg: "found", data };
|
||||
return { status: 200, ref: "Odmdb", msg: "profilallow", data };
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -336,7 +336,7 @@ Odmdb.ASUPreads = (objectPathname, apxidlist, role, propertiesfilter) => {
|
||||
return {
|
||||
status: 403,
|
||||
ref: "Odmdb",
|
||||
msg: "accessforbidden",
|
||||
msg: "profilnotallow",
|
||||
data: { crud: "R", accessright },
|
||||
};
|
||||
}
|
||||
@@ -492,7 +492,7 @@ Odmdb.cud = (objectPathname, crud, itm, role, runindex = true) => {
|
||||
return {
|
||||
status: 403,
|
||||
ref: "Odmdb",
|
||||
msg: "accessforbidden",
|
||||
msg: "profilnotallow",
|
||||
data: { crud, accessright },
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,20 @@
|
||||
{
|
||||
"schemanotfound":"Schema not found in {{{fullpath}}}",
|
||||
"pathnamedoesnotexist":"ObjectPath or objectName does not exist {{{indexpath}}}",
|
||||
"objectfiledoesnotexist":"Requested index does not exist here: {{{objectpath}}}"
|
||||
}
|
||||
"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"
|
||||
}
|
@@ -10,7 +10,8 @@
|
||||
"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 de {{profils}}, cette action n'est pas authorisée",
|
||||
"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",
|
||||
|
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"errrequest": "Backend seems not available",
|
||||
"missingheader": "Some header miss to have a valid request: {{#data}} {{.}} {{/data}}",
|
||||
"tribeiddoesnotexist": "Header xtribe: {{data.xtribe}} does not exist in this town you cannot access",
|
||||
"authenticated": "Your alias{{{data.xalias}}} is authenticated",
|
||||
"notauthenticated": "Your alias: {{data.xalias}} is not authenticated {{^data.aliasexists}} and this alias does not exist !{{/data.aliasexists}}",
|
||||
"forbiddenAccessright": "Alias {{data.xalias}} has not access right to act {{data.action}} onto object {{data.object}} for tribe {{mor.xworkon}}"
|
||||
"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 +1,10 @@
|
||||
{
|
||||
"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 : {{#data}} {{.}} {{/data}}",
|
||||
"tribeiddoesnotexist": "L'en-tête xtribe : {{data.xtribe}} n'existe pas dans cette ville, vous ne pouvez pas y accéder",
|
||||
"authenticated": "Votre alias {{{data.xalias}}} est authentifié",
|
||||
"notauthenticated": "Votre alias : {{data.xalias}} n'est pas authentifié {{^data.aliasexists}} et cet alias n'existe pas !{{/data.aliasexists}}",
|
||||
"forbiddenAccessright": "L'alias {{data.xalias}} n'a pas le droit d'agir {{data.action}} sur l'objet {{data.object}} pour la tribu {{mor.xworkon}}",
|
||||
"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."
|
||||
}
|
||||
|
Reference in New Issue
Block a user