Module: check_mk
Branch: master
Commit: 9e2aef2f5a5fde00ce123a99a647e3ebbdf2341c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e2aef2f5a5fde…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 30 10:29:43 2018 +0200
6053 FIX Fixed sync after user notification rule changes
When a user changes his personal notification rules in a distributed
environment, the user profile synchronization was only performed for the
configured "login sites". These are the sites where user logins are allowed (by
the site configuration). In case of notification setting changes the notification
rules need to be synchronized to all sites instead.
Change-Id: I6d9f4b9ee0cecba116d16fc917973c04ca610ff5
---
.werks/6053 | 15 +++++++++++++++
web/htdocs/wato.py | 11 ++++++-----
web/htdocs/watolib.py | 5 +++++
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/.werks/6053 b/.werks/6053
new file mode 100644
index 0000000..d9dfaba
--- /dev/null
+++ b/.werks/6053
@@ -0,0 +1,15 @@
+Title: Fixed sync after user notification rule changes
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525074833
+
+When a user changes his personal notification rules in a distributed
+environment, the user profile synchronization was only performed for the
+configured "login sites". These are the sites where user logins are allowed
(by
+the site configuration). In case of notification setting changes the notification
+rules need to be synchronized to all sites instead.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f15da8b..639c28d 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9105,7 +9105,7 @@ def mode_user_notifications(phase, profilemode):
return
if notification_rule_start_async_repl:
- user_profile_async_replication_dialog()
+ user_profile_async_replication_dialog(sites=get_notification_sync_sites())
notification_rule_start_async_repl = False
html.h3(_('Notification Rules'))
@@ -9224,7 +9224,7 @@ def mode_notification_rule(phase, profilemode):
return "notifications"
if notification_rule_start_async_repl:
- user_profile_async_replication_dialog()
+ user_profile_async_replication_dialog(sites=get_notification_sync_sites())
notification_rule_start_async_repl = False
return
@@ -14799,12 +14799,12 @@ def user_profile_async_replication_page():
html.context_button(_('User Profile'), 'user_profile.py',
'back')
html.end_context_buttons()
- user_profile_async_replication_dialog()
+ user_profile_async_replication_dialog(sites=config.user.authorized_login_sites())
html.footer()
-def user_profile_async_replication_dialog():
+def user_profile_async_replication_dialog(sites):
repstatus = watolib.load_replication_status()
html.message(_('In order to activate your changes available on all remote sites,
your user profile needs '
@@ -14815,7 +14815,8 @@ def user_profile_async_replication_dialog():
html.h3(_('Replication States'))
html.open_div(id_="profile_repl")
num_replsites = 0
- for site_id, site in config.user.authorized_login_sites():
+ for site_id in sites:
+ site = config.sites[site_id]
srs = repstatus.get(site_id, {})
if not "secret" in site:
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index d5f145c..918aa16 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -4321,6 +4321,11 @@ def get_event_console_sync_sites():
return [ s[0] for s in config.get_event_console_site_choices() ]
+def get_notification_sync_sites():
+ return sorted([ site_id for site_id, site in wato_slave_sites()
+ if not config.site_is_local(site_id) ])
+
+
# TODO: cleanup all call sites to this name
site_choices = config.site_choices