From 7e7fe57fc9098e81ce90f4d56b1a3154abfa6123 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 31 Jul 2014 10:14:32 +0200 Subject: webui: hide non-readable fields hide widgets if associated field had received attribute level rights without 'r' right. Explicit rights are required to avoid hiding of special widgets which are not associated with any LDAP attribute. https://fedorahosted.org/freeipa/ticket/4402 Reviewed-By: Endi Sukma Dewata --- install/ui/src/freeipa/widget.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'install/ui/src/freeipa/widget.js') diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index d5837e7ea..252fe0208 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -406,6 +406,9 @@ IPA.input_widget = function(spec) { */ that.ctor_init = function() { on(that, 'value-change', that.hide_if_empty); + on(that, 'readable-change', function() { + that.set_visible(); + }); }; /** @@ -641,9 +644,22 @@ IPA.input_widget = function(spec) { if (that.has_value === false && !that.is_writable() && that.hidden_if_empty) { visible = false; } + if (that.readable !== undefined) { + visible = visible && that.readable; + } return visible; }; + that.set_readable = function(readable) { + + var old = that.readable; + that.readable = readable; + + if (old !== that.readable) { + that.emit('readable-change', { source: that, readable: readable }); + } + }; + /** * Widget is writable * @return {boolean} -- cgit