- fix: l'admin non riusciva a cambiare il Circuito...
This commit is contained in:
@@ -3032,7 +3032,7 @@ module.exports = {
|
||||
);
|
||||
|
||||
if (this.testing()) {
|
||||
console.log('query', query);
|
||||
// console.log('query', query);
|
||||
}
|
||||
// console.log('query', query);
|
||||
|
||||
@@ -3815,7 +3815,9 @@ module.exports = {
|
||||
return mystr.replace(/\s+/g, '');
|
||||
},
|
||||
|
||||
ModificheConsentite(req, table, fieldsvalue, idrec, user) {
|
||||
async ModificheConsentite(req, table, fieldsvalue, idrec, user) {
|
||||
const { Circuit } = require('../models/circuit');
|
||||
|
||||
if (table === 'sharewithus') {
|
||||
return true;
|
||||
}
|
||||
@@ -3839,6 +3841,18 @@ module.exports = {
|
||||
//++Todo: Cancellalo solo se sono io il creatore dell'utente ... o se posso!
|
||||
return true;
|
||||
}
|
||||
} else if (table === 'circuits') {
|
||||
if (idrec) {
|
||||
// Permetti di fare modifiche se è un admin del circuito
|
||||
return await Circuit.isCircuitAdmin(idrec, req.user ? req.user.username : '');
|
||||
}
|
||||
} else if (table === 'accounts') {
|
||||
if (idrec) {
|
||||
if ('fidoConcesso' in fieldsvalue) {
|
||||
// Permetti di fare modifiche se è un admin del circuito
|
||||
return await Circuit.isCircuitAdmin(idrec, req.user ? req.user.username : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shared_consts.TABLES_PERM_CHANGE_FOR_USERS.includes(table)) {
|
||||
@@ -4171,7 +4185,7 @@ module.exports = {
|
||||
if (msg.includes('{appname}'))
|
||||
msg = msg.replace('{appname}', this.getNomeAppByIdApp(user.idapp));
|
||||
msg = msg.replace('{username}', user.username);
|
||||
msg = await this.checkStr(msg, '{time_exp_reg}', user, 1);
|
||||
// msg = await this.checkStr(msg, '{time_exp_reg}', user, 1);
|
||||
msg = msg.replace('{name}', user.name ? user.name : user.username);
|
||||
msg = msg.replace('{surname}', user.surname ? user.surname : '');
|
||||
|
||||
@@ -4421,7 +4435,7 @@ module.exports = {
|
||||
|
||||
/*if (params.openUrl)
|
||||
content = content + '\n' + '<a href="' + myhost + params.openUrl + '">' + i18n.__('OPEN PAGE') + '</a>';
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user