From f85771b2a7117c8870d800ee863ccf10fe0b13c3 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Mon, 31 Jan 2011 17:24:42 -0500 Subject: aci association fixes declarative priv definition fixes role_add_privilege and privilege_add_permisison --- install/ui/aci.js | 62 +++++++++++++++++++++++-------------------------- install/ui/associate.js | 6 +++-- install/ui/entity.js | 9 ++++++- 3 files changed, 41 insertions(+), 36 deletions(-) (limited to 'install') diff --git a/install/ui/aci.js b/install/ui/aci.js index ffe264d83..d0150c80f 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -791,42 +791,33 @@ IPA.entity_factories.permission = function () { IPA.entity_factories.privilege = function() { var that = IPA.entity({ 'name': 'privilege' - }); - that.init = function() { - - var search_facet = IPA.search_facet({ - name: 'search', - label: 'Search', - entity_name: that.name - }); - search_facet.create_column({name:'cn'}); - search_facet.create_column({name:'description'}); - that.add_facet(search_facet); - - that.add_facet(function() { - var that = IPA.details_facet({name:'details'}); - that.add_section( - IPA.stanza({name:'identity', label:'Privilege Settings'}). - input({name:'cn'}). - input({name: 'description'})); - return that; - }()); - + }). + facet( + IPA.search_facet(). + column({name:'cn'}). + column({name:'description'})). + facet( + IPA.details_facet({name:'details'}). + section( + IPA.stanza({name:'identity', label:'Privilege Settings'}). + input({name:'cn'}). + input({name: 'description'}))). + add_dialog( + IPA.add_dialog({ + name: 'add', + title: 'Add Privilege'}). + field(IPA.text_widget({ name: 'cn', undo: false})). + field(IPA.text_widget({ name: 'description', undo: false}))). + association({ + name: 'permission', + other_entity: 'privilege', + add_method: 'add_permission', + remove_method: 'remove_permission' + }). - var dialog = IPA.add_dialog({ - name: 'add', - title: 'Add Privilege', - entity_name: that.entity - }); - that.add_dialog(dialog); + standard_associations(); - dialog.add_field(IPA.text_widget({ name: 'cn', undo: false})); - dialog.add_field(IPA.text_widget({ name: 'description', undo: false})); - dialog.init(); - that.create_association_facets(); - that.entity_init(); - }; return that; }; @@ -851,6 +842,11 @@ IPA.entity_factories.role = function() { }). field(IPA.text_widget({ name: 'cn', undo: false})). field(IPA.text_widget({ name: 'description', undo: false}))). + association({ + name: 'privilege', + add_method: 'add_privilege', + remove_method: 'remove_privilege' + }). standard_associations(); }; diff --git a/install/ui/associate.js b/install/ui/associate.js index bdb10337a..15fe8fedc 100644 --- a/install/ui/associate.js +++ b/install/ui/associate.js @@ -454,7 +454,8 @@ IPA.association_table_widget = function (spec) { 'entity_name': that.entity_name, 'pkey': pkey, 'other_entity': that.other_entity, - 'attribute_member': that.attribute_member + 'attribute_member': that.attribute_member, + method:that.add_method }); }; @@ -518,7 +519,8 @@ IPA.association_table_widget = function (spec) { 'entity_name': that.entity_name, 'pkey': pkey, 'other_entity': that.other_entity, - 'values': selected_values + 'values': selected_values, + method:remove_method }); dialog.remove = function() { diff --git a/install/ui/entity.js b/install/ui/entity.js index 82af8234e..4a8971d35 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -204,7 +204,14 @@ IPA.entity = function (spec) { }; if (config){ - spec.associator = config.associator; + for (var key in config){ + /*name is special, as iut has already been munged + into the association name */ + if (key === "name"){ + continue; + } + spec[key] = config[key] ; + } } facet = IPA.association_facet(spec); -- cgit