- Sistemato i Referenti (e non Editori), quando crei un nuovo Catalogo ti imposta la proprietà a te, ma chiunque Collaboratore potrebbe cmq modificartelo.
This commit is contained in:
@@ -93,6 +93,12 @@ const CatalogSchema = new Schema({
|
|||||||
data_lista_generata: {
|
data_lista_generata: {
|
||||||
type: Date,
|
type: Date,
|
||||||
},
|
},
|
||||||
|
data_lista_updated: {
|
||||||
|
type: Date,
|
||||||
|
},
|
||||||
|
username_lista_updated: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
pdf_online: String,
|
pdf_online: String,
|
||||||
pdf_online_size: String,
|
pdf_online_size: String,
|
||||||
data_online: {
|
data_online: {
|
||||||
|
|||||||
@@ -51,9 +51,10 @@ router.get('/id/:id', async function (req, res) {
|
|||||||
router.post('/addnew', authenticate, async function (req, res, next) {
|
router.post('/addnew', authenticate, async function (req, res, next) {
|
||||||
const idapp = req.body.idapp;
|
const idapp = req.body.idapp;
|
||||||
const data = req.body.newCatalog;
|
const data = req.body.newCatalog;
|
||||||
|
const username = req.user.username;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newrecs = await globalTables.addNewCatalog(idapp, data);
|
const newrecs = await globalTables.addNewCatalog(idapp, data, username);
|
||||||
if (newrecs) {
|
if (newrecs) {
|
||||||
return res.send({ code: server_constants.RIS_CODE_OK, data: newrecs });
|
return res.send({ code: server_constants.RIS_CODE_OK, data: newrecs });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -721,6 +721,16 @@ router.post('/getobj', authenticate_noerror, async (req, res) => {
|
|||||||
)
|
)
|
||||||
.sort({ username: 1 })
|
.sort({ username: 1 })
|
||||||
.lean();
|
.lean();
|
||||||
|
} else if (cmd === 'lista_referenti') {
|
||||||
|
ris = await User.find(
|
||||||
|
{
|
||||||
|
idapp,
|
||||||
|
perm: { $bitsAnySet: 0b110010000 },
|
||||||
|
},
|
||||||
|
{ username: 1, name: 1, surname: 1 }
|
||||||
|
)
|
||||||
|
.sort({ username: 1 })
|
||||||
|
.lean();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invia la risposta
|
// Invia la risposta
|
||||||
|
|||||||
@@ -984,7 +984,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async cloneCatalog(idapp, idOrig, newName, idPageAssigned) {
|
async cloneCatalog(idapp, idOrig, newName, idPageAssigned, referenti) {
|
||||||
try {
|
try {
|
||||||
// Recupera il catalogo originale
|
// Recupera il catalogo originale
|
||||||
const mycatalog = await Catalog.findOne({ idapp, _id: idOrig }).lean();
|
const mycatalog = await Catalog.findOne({ idapp, _id: idOrig }).lean();
|
||||||
@@ -1014,6 +1014,7 @@ module.exports = {
|
|||||||
pagina_introduttiva_sfondo_nero: mycatalog.pagina_introduttiva_sfondo_nero,
|
pagina_introduttiva_sfondo_nero: mycatalog.pagina_introduttiva_sfondo_nero,
|
||||||
backcolor: mycatalog.backcolor,
|
backcolor: mycatalog.backcolor,
|
||||||
idPageAssigned: idPageAssigned,
|
idPageAssigned: idPageAssigned,
|
||||||
|
referenti,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mydirpath = tools.getdirByIdApp(idapp);
|
const mydirpath = tools.getdirByIdApp(idapp);
|
||||||
@@ -1034,7 +1035,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async newEmptyCatalog(idapp, newName, idPageAssigned) {
|
async newEmptyCatalog(idapp, newName, idPageAssigned, referenti) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const clonedCatalog = {
|
const clonedCatalog = {
|
||||||
@@ -1042,6 +1043,7 @@ module.exports = {
|
|||||||
active: true,
|
active: true,
|
||||||
title: newName,
|
title: newName,
|
||||||
idPageAssigned: idPageAssigned,
|
idPageAssigned: idPageAssigned,
|
||||||
|
referenti,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Salva la pagina
|
// Salva la pagina
|
||||||
@@ -1126,7 +1128,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async addNewCatalog(idapp, newCatalog) {
|
async addNewCatalog(idapp, newCatalog, username) {
|
||||||
try {
|
try {
|
||||||
if (newCatalog) {
|
if (newCatalog) {
|
||||||
const myNewrecs = await this.duplicatePage(newCatalog.idPageTemplate, newCatalog.path, newCatalog.title);
|
const myNewrecs = await this.duplicatePage(newCatalog.idPageTemplate, newCatalog.path, newCatalog.title);
|
||||||
@@ -1144,13 +1146,15 @@ module.exports = {
|
|||||||
idapp,
|
idapp,
|
||||||
newCatalog.idCatalogToCopy,
|
newCatalog.idCatalogToCopy,
|
||||||
newCatalog.title,
|
newCatalog.title,
|
||||||
myNewrecs?.newPage._id
|
myNewrecs?.newPage._id,
|
||||||
|
[username],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
mynewCatalog = await this.newEmptyCatalog(
|
mynewCatalog = await this.newEmptyCatalog(
|
||||||
idapp,
|
idapp,
|
||||||
newCatalog.title,
|
newCatalog.title,
|
||||||
myNewrecs?.newPage._id
|
myNewrecs?.newPage._id,
|
||||||
|
[username],
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.2.58
|
1.2.59
|
||||||
Reference in New Issue
Block a user