From bf9234dbd1911a6e720470844ad053053144cc45 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 23 May 2012 11:52:20 +0200 Subject: Enable reset password action according to attribute perrmission This patch creates state_evaluator which creates permission states for defined attribute. The state format is: attributeName_permissionChar. This evaluator is used for user_password attribute and it control enabling/disabling of related action in user account action panel. https://fedorahosted.org/freeipa/ticket/2318 --- install/ui/details.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'install/ui/details.js') diff --git a/install/ui/details.js b/install/ui/details.js index ff8f4409..4239f654 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -969,6 +969,40 @@ IPA.enable_state_evaluator = function(spec) { return that; }; +IPA.acl_state_evaluator = function(spec) { + + spec.name = spec.name || 'acl_state_evaluator'; + spec.event = spec.event || 'post_load'; + + var that = IPA.state_evaluator(spec); + that.attribute = spec.attribute; + + that.on_event = function(data) { + + var old_state, record, rights, i, state; + + old_state = that.state; + record = data.result.result; + + that.state = []; + + if (record.attributelevelrights) { + rights = record.attributelevelrights[that.attribute]; + } + + rights = rights || ''; + + for (i=0; i