Mostrare il Bene, Servizio, solo ai Propri Gruppi.

Nella pagina profilo, i "Gruppi" personali non si vedevano !
This commit is contained in:
Paolo Arena
2022-06-16 20:34:42 +02:00
parent d8aa8e546e
commit c3b0a1f417
17 changed files with 170 additions and 52 deletions

View File

@@ -106,7 +106,7 @@ MyGroupSchema.statics.getFieldsForSearch = function() {
return [{field: 'descr', type: tools.FieldType.string}];
};
MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
MyGroupSchema.statics.executeQueryTable = function(idapp, params, user) {
params.fieldsearch = this.getFieldsForSearch();
const { User } = require('./user');
@@ -119,7 +119,7 @@ MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
}
}
return tools.executeQueryTable(this, idapp, params);
return tools.executeQueryTable(this, idapp, params, user);
};
MyGroupSchema.pre('save', async function(next) {
@@ -149,6 +149,18 @@ MyGroupSchema.statics.findAllIdApp = async function(idapp) {
return await MyGroup.find(myfind);
};
MyGroupSchema.statics.findAllGroups = async function(idapp) {
const whatToShow = this.getWhatToShow(idapp, '');
return await MyGroup.find({
idapp,
$or: [
{deleted: {$exists: false}},
{deleted: {$exists: true, $eq: false}}],
}, whatToShow);
};
// Rimuovo la Richiesta del Gruppo
MyGroupSchema.statics.removeReqGroup = async function(idapp, username, groupnameDest) {