From c1555967b021e530426079eb9999f568d6f5ef3e Mon Sep 17 00:00:00 2001 From: Samir Date: Sat, 9 Feb 2019 20:02:04 +0100 Subject: [PATCH 1/5] restrict notifications to allowed users --- connect/connectNotificationServer.js | 4 ++++ connect/events-config.js | 1 + 2 files changed, 5 insertions(+) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index e6ed1f4..81f8bf4 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -319,6 +319,10 @@ const handler = (topic, message, logger, callback) => { )).then((notifications) => { allNotifications = _.filter(notifications, notification => notification.userId !== `${message.initiatorUserId}`); + if (eventConfig.includeUsers){ + allNotifications = _.filter(allNotifications, notification => message[eventConfig.includeUsers].contains(notification.userId)); + } + // now let's retrieve some additional data // if message has userId such messages will likely need userHandle and user full name diff --git a/connect/events-config.js b/connect/events-config.js index 142d8aa..f476fee 100644 --- a/connect/events-config.js +++ b/connect/events-config.js @@ -145,6 +145,7 @@ const EVENTS = [ type: BUS_API_EVENT.CONNECT.PROJECT.FILE_UPLOADED, version: 2, projectRoles: [PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER, PROJECT_ROLE_MEMBER], + includeUsers: 'allowedUsers' }, { type: BUS_API_EVENT.CONNECT.PROJECT.SPECIFICATION_MODIFIED, version: 2, From 176400534b4350c2a92aaeda1fb2c45cdd00ba0f Mon Sep 17 00:00:00 2001 From: Samir Date: Sat, 9 Feb 2019 20:05:14 +0100 Subject: [PATCH 2/5] fix crash on invalid message --- connect/connectNotificationServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index 9c73e48..7fa03f9 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -321,7 +321,7 @@ const handler = (topic, message, logger, callback) => { )).then((notifications) => { allNotifications = _.filter(notifications, notification => notification.userId !== `${message.initiatorUserId}`); - if (eventConfig.includeUsers){ + if (eventConfig.includeUsers && message[eventConfig.includeUsers] && message[eventConfig.includeUsers].length>0){ allNotifications = _.filter(allNotifications, notification => message[eventConfig.includeUsers].contains(notification.userId)); } From 1e800921ed5e138cf2e1eb8f5f62f0ab5f554bf9 Mon Sep 17 00:00:00 2001 From: Samir Date: Sat, 9 Feb 2019 21:13:02 +0100 Subject: [PATCH 3/5] limit plan update notifications to allowed users --- connect/events-config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connect/events-config.js b/connect/events-config.js index dc98de5..01dac23 100644 --- a/connect/events-config.js +++ b/connect/events-config.js @@ -160,6 +160,7 @@ const EVENTS = [ }, { type: BUS_API_EVENT.CONNECT.PROJECT_PLAN.MODIFIED, projectRoles: [PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER, PROJECT_ROLE_MEMBER], + includeUsers: 'allowedUsers' }, { type: BUS_API_EVENT.CONNECT.PROJECT_PLAN.PROGRESS_UPDATED, projectRoles: [PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER, PROJECT_ROLE_MEMBER], @@ -199,6 +200,7 @@ const EVENTS = [ }, { type: BUS_API_EVENT.CONNECT.PROJECT_PLAN.TIMELINE_ADJUSTED, projectRoles: [PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER, PROJECT_ROLE_MEMBER], + includeUsers: allowedUsers } ]; From 878548da5dea6e1a25dfb85f41a66a974fc59f92 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Tue, 12 Feb 2019 11:41:18 +0530 Subject: [PATCH 4/5] SSO Login support in project invite email for unregistered users --- emails/src/partials/invites.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/emails/src/partials/invites.html b/emails/src/partials/invites.html index 4d2e158..4cd14e2 100644 --- a/emails/src/partials/invites.html +++ b/emails/src/partials/invites.html @@ -66,4 +66,36 @@ + + + + + + + +
If you are enterprise client with SSO, please use the link below to sign in and join the project.
+ + + + + + + + + + +
+ + SSO Login + +
+ + + + + + +
+ + {{/if}} \ No newline at end of file From d1eefb9b868e4302fa4fd270e6ffb361803962fa Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Tue, 12 Feb 2019 11:44:56 +0530 Subject: [PATCH 5/5] =?UTF-8?q?Syncing=20the=20way=20we=20are=20specifying?= =?UTF-8?q?=20the=20=E2=80=98allowedUsers`=20field=20in=20the=20event=20co?= =?UTF-8?q?nfig=20to=20match=20the=20other=20places=20we=20are=20using=20t?= =?UTF-8?q?he=20same?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect/events-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/events-config.js b/connect/events-config.js index 01dac23..98b2cdb 100644 --- a/connect/events-config.js +++ b/connect/events-config.js @@ -200,7 +200,7 @@ const EVENTS = [ }, { type: BUS_API_EVENT.CONNECT.PROJECT_PLAN.TIMELINE_ADJUSTED, projectRoles: [PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER, PROJECT_ROLE_MEMBER], - includeUsers: allowedUsers + includeUsers: 'allowedUsers' } ];