diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-08-03 13:39:25 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-08-14 08:09:50 +0200 |
commit | ade68ec94f00f69033b310c74467c4e5c1dda35c (patch) | |
tree | c9d1e6bf5210a66286cde73cdefe60973748fda7 /install/ui/association.js | |
parent | 994eeb55c9b232c103deed3f41da238d142c214b (diff) | |
download | freeipa-ade68ec94f00f69033b310c74467c4e5c1dda35c.tar.gz freeipa-ade68ec94f00f69033b310c74467c4e5c1dda35c.tar.xz freeipa-ade68ec94f00f69033b310c74467c4e5c1dda35c.zip |
Read-only external facet for non-external groups
Added evaluators to decide if attribute facet should be read-only based on attribute level rights.
Default values serves well for group's external member.
https://fedorahosted.org/freeipa/ticket/2895
Diffstat (limited to 'install/ui/association.js')
-rw-r--r-- | install/ui/association.js | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index a30ca5328..bb10387a5 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -1185,7 +1185,11 @@ IPA.attribute_facet = function(spec, no_init) { spec.state.evaluators = spec.state.evaluators || []; spec.state.evaluators.push( IPA.selected_state_evaluator, - IPA.read_only_state_evaluator); + IPA.read_only_state_evaluator, + { + factory: IPA.attr_read_only_evaluator, + attribute: spec.attribute + }); spec.columns = spec.columns || [ spec.attribute ]; spec.table_name = spec.table_name || spec.attribute; @@ -1235,6 +1239,13 @@ IPA.attribute_facet = function(spec, no_init) { args: pkey }); + if (command.check_option('all')) { + command.set_option('all', true); + } + if (command.check_option('rights')) { + command.set_option('rights', true); + } + command.on_success = function(data, text_status, xhr) { that.load(data); that.show_content(); @@ -1323,6 +1334,13 @@ IPA.attribute_facet = function(spec, no_init) { command.set_option(that.attribute, values); + if (command.check_option('all')) { + command.set_option('all', true); + } + if (command.check_option('rights')) { + command.set_option('rights', true); + } + command.execute(); }; @@ -1337,4 +1355,36 @@ IPA.attribute_facet = function(spec, no_init) { if (!no_init) that.init_attribute_facet(); return that; +}; + +IPA.attr_read_only_evaluator = function(spec) { + + spec.name = spec.name || 'attr_read_only_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; + + // ignore loads without --rights + if (!record.attributelevelrights) return; + + that.state = []; + + rights = record.attributelevelrights[that.attribute]; + + if (!rights || rights.indexOf('w') === -1) { + that.state.push('read-only'); + } + + that.notify_on_change(old_state); + }; + + return that; };
\ No newline at end of file |