Module: check_mk
Branch: master
Commit: 3382452c32c9c5015940575dff2017ce3d11fa2c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3382452c32c9c5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 2 15:10:58 2015 +0100
#2084 FIX Disabled notification for a user is now shown on profile page even when not
permitted to edit
When all notifications have been disabled for a user this is shown on the user profile
page
and user edit page even when the user is not able to edit this value.
The locking / disabled notification state is shown in the WATOs user list as icons now.
---
.werks/2084 | 13 +++++++++++
ChangeLog | 1 +
web/htdocs/images/icon_user_locked.png | Bin 0 -> 4520 bytes
web/htdocs/wato.py | 39 ++++++++++++++++++--------------
4 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/.werks/2084 b/.werks/2084
new file mode 100644
index 0000000..2a12942
--- /dev/null
+++ b/.werks/2084
@@ -0,0 +1,13 @@
+Title: Disabled notification for a user is now shown on profile page even when not
permitted to edit
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1425305351
+
+When all notifications have been disabled for a user this is shown on the user profile
page
+and user edit page even when the user is not able to edit this value.
+
+The locking / disabled notification state is shown in the WATOs user list as icons now.
diff --git a/ChangeLog b/ChangeLog
index 7426576..75306f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -303,6 +303,7 @@
* 2026 FIX: Fixed exception when using umlauts in notification plugin
descriptions...
* 2078 FIX: Fixed exception with some snapshots when using a localized GUI...
* 2080 FIX: Fixed UnicodeDecodeError when using a localized GUI on notification
configuration page
+ * 2084 FIX: Disabled notification for a user is now shown on profile page even when
not permitted to edit...
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/web/htdocs/images/icon_user_locked.png
b/web/htdocs/images/icon_user_locked.png
new file mode 100644
index 0000000..67f53d8
Binary files /dev/null and b/web/htdocs/images/icon_user_locked.png differ
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e350dac..4f96048 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11787,9 +11787,12 @@ def mode_users(phase):
auth_method = "<i>%s</i>" % _("none")
table.cell(_("Authentication"), auth_method)
- # Locked
+ table.cell(_("State"))
locked = user.get("locked", False)
- table.cell(_("Locked"), (locked and ("<b>" +
_("yes") + "</b>") or _("no")))
+ if user.get("locked", False):
+ html.icon(_('The login is currently locked'), 'user_locked')
+ if user.get("disable_notifications", False):
+ html.icon(_('Notifications are disabled'), 'notif_disabled')
# Full name / Alias
table.cell(_("Alias"), user.get("alias", ""))
@@ -11894,18 +11897,17 @@ def mode_edit_user(phase):
if topic is not None and topic != attr['topic']:
continue # skip attrs of other topics
- if not userid or not attr.get("permission") or
config.user_may(userid, attr["permission"]):
- vs = attr['valuespec']
- forms.section(_u(vs.title()))
- if attr['user_editable'] and not is_locked(name):
- vs.render_input("ua_" + name, user.get(name,
vs.default_value()))
- else:
- html.write(vs.value_to_text(user.get(name, vs.default_value())))
- # Render hidden to have the values kept after saving
- html.write('<div style="display:none">')
- vs.render_input("ua_" + name, user.get(name,
vs.default_value()))
- html.write('</div>')
- html.help(_u(vs.help()))
+ vs = attr['valuespec']
+ forms.section(_u(vs.title()))
+ if attr['user_editable'] and not is_locked(name):
+ vs.render_input("ua_" + name, user.get(name,
vs.default_value()))
+ else:
+ html.write(vs.value_to_text(user.get(name, vs.default_value())))
+ # Render hidden to have the values kept after saving
+ html.write('<div style="display:none">')
+ vs.render_input("ua_" + name, user.get(name,
vs.default_value()))
+ html.write('</div>')
+ html.help(_u(vs.help()))
# Load data that is referenced - in order to display dropdown
# boxes and to check for validity.
@@ -15959,11 +15961,14 @@ def page_user_profile(change_pw=False):
if config.may('general.edit_user_attributes'):
for name, attr in userdb.get_user_attributes():
if attr['user_editable']:
+ vs = attr['valuespec']
+ forms.section(_u(vs.title()))
+ value = user.get(name, vs.default_value())
if not attr.get("permission") or
config.may(attr["permission"]):
- vs = attr['valuespec']
- forms.section(_u(vs.title()))
- vs.render_input("ua_" + name, user.get(name,
vs.default_value()))
+ vs.render_input("ua_" + name, value)
html.help(_u(vs.help()))
+ else:
+ html.write(vs.value_to_text(value))
# Save button
forms.end()