From c3f341f1edc19bf76359335b12de13f66ebd955b Mon Sep 17 00:00:00 2001
From: Carina Antunes <carina.oliveira.antunes@cern.ch>
Date: Thu, 21 Apr 2022 15:30:49 +0200
Subject: [PATCH] audit group data

---
 notifications_routing/router.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/notifications_routing/router.py b/notifications_routing/router.py
index d70bf9b..d4d2848 100644
--- a/notifications_routing/router.py
+++ b/notifications_routing/router.py
@@ -85,11 +85,12 @@ class Router(megabus.Listener):
     ):
         """Add users from groups to users list."""
         unique_usernames = [channel_user[self.data_source.USERNAME] for channel_user in users]
-        logging.debug("channel %s usernames: %s", channel_id, unique_usernames)
+        logging.debug("notification %s channel usernames: %s", notification_id, unique_usernames)
 
         for group_id in groups:
             group_users = self.data_source.get_group_users(group_id)
-            logging.debug("channel %s groups %s", channel_id, group_users)
+            audit_notification(notification_id, {"event": "get_group_users", "group": group_id, "users": group_users})
+            logging.debug("channel %s groups users %s", channel_id, group_users)
 
             for user in group_users:
                 if user[self.data_source.USERNAME] in unique_usernames:
@@ -106,7 +107,7 @@ class Router(megabus.Listener):
                     users.append(user)
                     unique_usernames.append(user[self.data_source.USERNAME])
 
-        logging.debug("channel %s final users %s", channel_id, users)
+        logging.debug("notification %s final users %s", notification_id, users)
 
     def get_channel_users(self, notification_id, channel_id):
         """Join users from our data source and the grappa system to return a unique users list."""
-- 
GitLab