Module: check_mk
Branch: master
Commit: a98c49386e72a121ac81bb9b34364c0ff51a4cb0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a98c49386e72a1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Sep 20 10:42:00 2017 +0200
5295 FIX Service discovery: Fixed permission handling regarding foreign changes if user
just performs a service discovery
If a user is not allowed to activate foreign changes but wants to
perform a service discovery of hosts configured on slave sites,
this action was falsely forbidden by Check_MK showing
<tt>There are some changes made by your colleagues that you can not
activate because you are not permitted to. You can only activate
the changes on the sites that are not affected by these changes.</tt>
Only if the user wants to activate these changes and does not have
the right permissions the above warning message should be displayed.
Change-Id: I22b2c8e4959e4053bedb6507a6ab781d79a5e22d
---
.werks/5295 | 18 ++++++++++++++++++
web/htdocs/watolib.py | 20 +++++++++-----------
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/.werks/5295 b/.werks/5295
new file mode 100644
index 0000000..3b00686
--- /dev/null
+++ b/.werks/5295
@@ -0,0 +1,18 @@
+Title: Service discovery: Fixed permission handling regarding foreign changes if user
just performs a service discovery
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1505896357
+
+If a user is not allowed to activate foreign changes but wants to
+perform a service discovery of hosts configured on slave sites,
+this action was falsely forbidden by Check_MK showing
+<tt>There are some changes made by your colleagues that you can not
+activate because you are not permitted to. You can only activate
+the changes on the sites that are not affected by these changes.</tt>
+Only if the user wants to activate these changes and does not have
+the right permissions the above warning message should be displayed.
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index f6de125..2027b6f 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -4936,18 +4936,16 @@ class ActivateChangesManager(ActivateChanges):
def _create_site_sync_snapshot(self, site_id):
- has_foreign = self._site_has_foreign_changes(site_id)
+ if self._site_has_foreign_changes(site_id) and not self._activate_foreign:
+ if not config.user.may("wato.activateforeign"):
+ raise MKUserError(None,
+ _("There are some changes made by your colleagues that you can
not "
+ "activate because you are not permitted to. You can only
activate "
+ "the changes on the sites that are not affected by these
changes. "
+ "<br>"
+ "If you need to activate your changes on all sites, please
contact "
+ "a permitted user to do it for you."))
- if has_foreign and not config.user.may("wato.activateforeign"):
- raise MKUserError(None,
- _("There are some changes made by your colleagues that you can not
"
- "activate because you are not permitted to. You can only activate
"
- "the changes on the sites that are not affected by these changes.
"
- "<br>"
- "If you need to activate your changes on all sites, please contact
"
- "a permitted user to do it for you."))
-
- if has_foreign and not self._activate_foreign:
raise MKUserError(None,
_("There are some changes made by your colleagues and you did not
"
"confirm to activate these changes. In order to proceed, you will
"