diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-05-23 11:52:20 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-06-04 10:45:08 +0200 |
commit | bf9234dbd1911a6e720470844ad053053144cc45 (patch) | |
tree | a2596f9971c062b332fdf7dbfcac215cc4182008 /install/ui/details.js | |
parent | bf0c6ff697182840f3e4fca0ee92e2a293296754 (diff) | |
download | freeipa-bf9234dbd1911a6e720470844ad053053144cc45.tar.gz freeipa-bf9234dbd1911a6e720470844ad053053144cc45.tar.xz freeipa-bf9234dbd1911a6e720470844ad053053144cc45.zip |
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
Diffstat (limited to 'install/ui/details.js')
-rw-r--r-- | install/ui/details.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/install/ui/details.js b/install/ui/details.js index ff8f4409b..4239f6547 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<rights.length; i++) { + state = that.attribute + '_' + rights.charAt(i); + that.state.push(state); + } + + that.notify_on_change(old_state); + }; + + return that; +}; + IPA.object_action = function(spec) { spec = spec || {}; |