From a2022f96cbda9854f50406eb2b478075d5df8630 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Thu, 11 Aug 2022 13:38:42 +0200 Subject: [PATCH] =?UTF-8?q?Private=20-=20Solo=20i=20membri=20possono=20ved?= =?UTF-8?q?ere=20chi=20fa=20parte=20del=20gruppo=20Hidden=20-=20il=20Grupp?= =?UTF-8?q?o=20non=20sar=C3=A0=20visibile=20nella=20ricerca?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/tools/general.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/server/tools/general.js b/src/server/tools/general.js index 089997c..c2b50f4 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -1036,8 +1036,6 @@ module.exports = { await this.sendNotifGroupByUsername(cmd, idapp, usernameOrig, usernameOrig, username_action, groupname, false); } - - } catch (e) { console.error('e', e); } @@ -1769,10 +1767,15 @@ module.exports = { } } + let filteradmin = false; if (params.filtercustom) { let condition = {}; for (const myfilter of params.filtercustom) { + if (!!myfilter.admins) { + filteradmin = true; + } + if (myfilter['pub_to_share'] === shared_consts.PUBTOSHARE.ONLY_GROUPS_FOLLOW) { let arraygroups = []; @@ -1854,13 +1857,30 @@ module.exports = { } } + if (params.table === 'mygroups') { + // BINARY CHECK (?): const filter = [{ visibility: { $bitsAnyClear: [1] } }]; + // if (!User.isAdmin(req.user.perm)) { + // not Visibility_Group.HIDDEN + if (true && !filteradmin) { + const filter = [ + { + visibility: { + $nin: [shared_consts.Visibility_Group.HIDDEN] + }, + }, + ]; + query.push({$match: {$and: filter}}); + } + // } + } + } else { // VECCHIA VERSIONE const q1 = this.getLookup(params, 1); if (q1) query = [...query, ...q1]; } - query.push( + query.push ( { $group: { _id: null,