diff --git a/install/ui/aci.js b/install/ui/aci.js
index 5d66bfb2b..cae067040 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -33,31 +33,32 @@ IPA.aci.permission_entity = function(spec) {
params.builder.facet_groups([ 'privilege' , 'settings' ]).
search_facet({
- columns:['cn']
+ columns: [ 'cn' ]
+ }).
+ details_facet({
+ sections: [
+ {
+ name: 'identity',
+ fields: [ 'cn' ]
+ },
+ {
+ name: 'rights',
+ label: IPA.messages.objects.permission.rights,
+ fields: [
+ {
+ factory: IPA.rights_widget,
+ name: 'permissions',
+ join: true
+ }
+ ]
+ },
+ {
+ factory: IPA.permission_target_section,
+ name: 'target',
+ label: IPA.messages.objects.permission.target
+ }
+ ]
}).
- details_facet({sections:[
- {
- name: 'identity',
- fields: [
- 'cn'
- ]
- },
- {
- name: 'rights',
- label: IPA.messages.objects.permission.rights,
- fields: [
- {
- factory: IPA.rights_widget,
- name: 'permissions',
- join: true
- }
- ]
- },
- {
- factory: IPA.target_section,
- name: 'target',
- label: IPA.messages.objects.permission.target
- }]}).
association_facet({
name: 'member_privilege',
facet_group: 'privilege'
@@ -77,9 +78,10 @@ IPA.aci.permission_entity = function(spec) {
]
},
{
- factory: IPA.target_section,
+ factory: IPA.permission_target_section,
name: 'target',
- label: IPA.messages.objects.permission.target
+ label: IPA.messages.objects.permission.target,
+ show_target: true
}
]
});
@@ -124,10 +126,10 @@ IPA.aci.privilege_entity = function(spec) {
associator: IPA.serial_associator
}).
association_facet({
- name: 'memberof_permission',
- facet_group: 'permission',
- add_method: 'add_permission',
- remove_method: 'remove_permission'
+ name: 'memberof_permission',
+ facet_group: 'permission',
+ add_method: 'add_permission',
+ remove_method: 'remove_permission'
}).
standard_association_facets().
adder_dialog({
@@ -173,10 +175,10 @@ IPA.aci.role_entity = function(spec) {
]
}).
association_facet({
- name: 'memberof_privilege',
- facet_group: 'privilege',
- add_method: 'add_privilege',
- remove_method: 'remove_privilege'
+ name: 'memberof_privilege',
+ facet_group: 'privilege',
+ add_method: 'add_privilege',
+ remove_method: 'remove_privilege'
}).
standard_association_facets().
adder_dialog({
@@ -201,25 +203,33 @@ IPA.aci.selfservice_entity = function(spec) {
params.builder.search_facet({
pagination: false,
- columns:['aciname']}).
+ columns: [ 'aciname' ]
+ }).
details_facet({
- sections:[{
- name:'general',
- label: IPA.messages.details.general,
- fields: [
- 'aciname',
- {
- factory:IPA.attributes_widget,
- object_type:'user',
- name:'attrs'
- }]}]}).
+ sections: [
+ {
+ name: 'general',
+ label: IPA.messages.details.general,
+ fields: [
+ 'aciname',
+ {
+ factory: IPA.attributes_widget,
+ object_type: 'user',
+ name: 'attrs'
+ }
+ ]
+ }
+ ]
+ }).
adder_dialog({
- fields:[
+ fields: [
'aciname',
- {factory:IPA.attributes_widget,
- object_type:'user',
- name:'attrs'
- }]
+ {
+ factory: IPA.attributes_widget,
+ object_type: 'user',
+ name: 'attrs'
+ }
+ ]
});
};
@@ -234,34 +244,40 @@ IPA.aci.delegation_entity = function(spec) {
params.builder.search_facet({
pagination: false,
- columns:['aciname']}).
- details_facet({sections:[
- {
- name:'general',
- label: IPA.messages.details.general,
- fields:[
- 'aciname',
- {
- factory: IPA.entity_select_widget,
- name: 'group',
- other_entity: 'group',
- other_field: 'cn'
- },
- {
- factory: IPA.entity_select_widget,
- name: 'memberof',
- other_entity: 'group',
- other_field: 'cn',
- join: true
- },
- {
- factory:IPA.attributes_widget,
- name: 'attrs', object_type: 'user',
- join: true
- }]}]}).
+ columns: [ 'aciname' ]
+ }).
+ details_facet({
+ sections: [
+ {
+ name: 'general',
+ label: IPA.messages.details.general,
+ fields: [
+ 'aciname',
+ {
+ factory: IPA.entity_select_widget,
+ name: 'group',
+ other_entity: 'group',
+ other_field: 'cn'
+ },
+ {
+ factory: IPA.entity_select_widget,
+ name: 'memberof',
+ other_entity: 'group',
+ other_field: 'cn',
+ join: true
+ },
+ {
+ factory: IPA.attributes_widget,
+ name: 'attrs', object_type: 'user',
+ join: true
+ }
+ ]
+ }
+ ]
+ }).
standard_association_facets().
adder_dialog({
- fields:[
+ fields: [
'aciname',
{
factory: IPA.entity_select_widget,
@@ -281,7 +297,8 @@ IPA.aci.delegation_entity = function(spec) {
name: 'attrs',
object_type: 'user',
join: true
- }]
+ }
+ ]
});
};
@@ -450,311 +467,161 @@ IPA.rights_widget = function(spec) {
return that;
};
-IPA.target_section = function(spec) {
+IPA.permission_target_section = function(spec) {
spec = spec || {};
- var that = IPA.details_section(spec);
+ var that = IPA.details_table_section(spec);
- var target_types = [
- {
- name: 'filter',
- label: IPA.messages.objects.permission.filter,
- create: function(container) {
- that.filter_text.create(container);
- },
- load: function(record) {
- that.filter_text.load(record);
- },
- save: function(record) {
- record.filter = that.filter_text.save();
- }
- },
- {
- name: 'subtree',
- label: IPA.messages.objects.permission.subtree,
- create: function(container) {
- that.subtree_textarea.create(container);
- },
- load: function(record) {
- that.subtree_textarea.load(record);
- },
- save: function(record) {
- record.subtree = that.subtree_textarea.save();
- }
- },
- {
- name: 'targetgroup',
- label: IPA.messages.objects.permission.targetgroup,
- create: function(container) {
- that.group_select.create(container);
- },
- load: function(record) {
- that.group_select.list.val(record.targetgroup);
- },
- save: function(record) {
- record.targetgroup = that.group_select.save();
- }
- },
- {
- name: 'type',
- label: IPA.messages.objects.permission.type,
- create: function(container) {
-
- var span = $('', {
- name: 'type'
- }).appendTo(container);
-
- that.type_select.create(span);
-
- span = $('', {
- name: 'attrs'
- }).appendTo(container);
-
- that.attribute_table.create(span);
-
- var select = that.type_select.select;
-
- select.change(function() {
- that.attribute_table.object_type =
- that.type_select.save()[0];
- that.attribute_table.reset();
- });
-
- select.append($('', {
- value: '',
- text: ''
- }));
-
- var type_params = IPA.get_entity_param('permission', 'type');
-
- for (var i=0; i', {
- value: type_params.values[i],
- text: type_params.values[i]
- }));
- }
-
- that.type_select.update = function() {
- that.type_select.select_update();
- that.attribute_table.object_type =
- that.type_select.save()[0];
- that.attribute_table.reset();
- };
- },
- load: function(record) {
- that.type_select.load(record);
- that.attribute_table.object_type = record.type;
- that.attribute_table.reset();
- },
- save: function(record) {
- record.type = that.type_select.save();
- record.attrs = that.attribute_table.save();
- }
- }] ;
-
- var target_type = target_types[0];
+ that.targets = [ 'filter', 'subtree', 'targetgroup', 'type' ];
+ that.target = that.targets[0];
+ that.show_target = spec.show_target;
var init = function() {
+
+ that.target_select = IPA.select_widget({
+ entity: that.entity,
+ name: 'target',
+ label: IPA.messages.objects.permission.target,
+ hidden: !that.show_target
+ });
+
+ for (var i=0; i', {
- 'class': 'section-table'
- }).appendTo(that.container);
-
- var tr = $('
').appendTo(table);
-
- var td = $(' | ', {
- 'class': 'section-cell-label'
- }).appendTo(tr);
-
- $('', {
- name: 'target',
- title: IPA.messages.objects.permission.target,
- 'class': 'field-label',
- text: IPA.messages.objects.permission.target+':'
- }).appendTo(td);
-
- if (that.undo) {
- tr.css('display', 'none');
- }
-
- td = $(' | ', {
- 'class': 'section-cell-field'
- }).appendTo(tr);
-
- var field_container = $('', {
- name: 'target',
- 'class': 'field'
- }).appendTo(td);
-
- that.target_type_select = $('', {
- change: function() {
- show_target_type(this.value);
- }
- }).appendTo(field_container);
-
- for (var i=0 ; i', {
- text: target_type.name,
- value : target_type.name
- }).appendTo(that.target_type_select);
-
- tr = $('
', {
- style: 'display: none'
- }).appendTo(table);
-
- td = $(' | ', {
- 'class': 'section-cell-label'
- }).appendTo(tr);
-
- $('', {
- name: target_type.name,
- title: target_type.label,
- 'class': 'field-label',
- text: target_type.label+':'
- }).appendTo(td);
-
- td = $(' | ', {
- 'class': 'section-cell-field'
- }).appendTo(tr);
-
- field_container = $('', {
- name: target_type.name,
- title: target_type.label,
- 'class': 'field'
- }).appendTo(td);
-
- target_type.create(field_container);
- target_type.container = tr;
- }
+ that.table_section_create(container);
+ that.select_target(that.targets[0]);
};
- function reset_target_widgets() {
- that.filter_text.record = null;
- that.subtree_textarea.record = null;
- that.group_select.record = null;
- that.type_select.record = null;
- that.attribute_table.record = null;
+ that.load = function(record) {
- that.filter_text.reset();
- that.subtree_textarea.reset();
- that.group_select.reset();
- that.type_select.reset();
- that.attribute_table.reset();
- }
-
- function set_target_type(record) {
-
- reset_target_widgets();
-
- var target_type_name ;
- for (var i=0; i', {
name: field.name,
title: field.label,
'class': 'field'
- }).appendTo(container);
+ });
+
+ if (field.hidden) {
+ field_container.css('display', 'none');
+ }
+
+ field_container.appendTo(container);
+
field.create(field_container);
}
};
@@ -237,6 +243,8 @@ IPA.details_table_section = function(spec) {
var that = IPA.details_section(spec);
+ that.rows = $.ordered_map();
+
that.create = function(container) {
that.container = container;
@@ -249,9 +257,15 @@ IPA.details_table_section = function(spec) {
var fields = that.fields.values;
for (var i=0; i').appendTo(table);
+ var tr = $('
');
+ that.add_row(field.name, tr);
+
+ if (field.hidden) {
+ tr.css('display', 'none');
+ }
+
+ tr.appendTo(table);
var td = $(' | ', {
'class': 'section-cell-label',
@@ -280,6 +294,19 @@ IPA.details_table_section = function(spec) {
}
};
+ that.add_row = function(name, row) {
+ that.rows.put(name, row);
+ };
+
+ that.get_row = function(name) {
+ return that.rows.get(name);
+ };
+
+ that.set_row_visible = function(name, visible) {
+ var row = that.get_row(name);
+ row.css('display', visible ? '' : 'none');
+ };
+
that.table_section_create = that.create;
return that;
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index 10b76aefc..2ff1acddd 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -37,7 +37,7 @@ module('aci',{
);
target_container = $('').appendTo(document.body);
- target_section = IPA.target_section({
+ target_section = IPA.permission_target_section({
name: 'target',
label: 'Target',
entity:entity
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 830b2d633..abaf4a78f 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -253,14 +253,10 @@
"identity": "Netgroup Settings"
},
"permission": {
- "filter": "Filter",
"identity": "Identity",
"invalid_target": "Permission with invalid target specification",
"rights": "Rights",
- "subtree": "By Subtree",
- "target": "Target",
- "targetgroup": "Target Group",
- "type": "Object By Type"
+ "target": "Target"
},
"privilege": {
"identity": "Privilege Settings"
diff --git a/install/ui/test/data/permission_show_filter.json b/install/ui/test/data/permission_show_filter.json
index a7390b4dd..c32bfb7b8 100644
--- a/install/ui/test/data/permission_show_filter.json
+++ b/install/ui/test/data/permission_show_filter.json
@@ -8,13 +8,17 @@
"businesscategory": "rscwo",
"cn": "rscwo",
"description": "rscwo",
+ "filter": "rscwo",
"member": "rscwo",
"nsaccountlock": "rscwo",
"o": "rscwo",
"objectclass": "rscwo",
"ou": "rscwo",
"owner": "rscwo",
- "seealso": "rscwo"
+ "seealso": "rscwo",
+ "subtree": "rscwo",
+ "targetgroup": "rscwo",
+ "type": "rscwo"
},
"cn": [
"filter"
diff --git a/install/ui/test/data/permission_show_subtree.json b/install/ui/test/data/permission_show_subtree.json
index 24255d4e9..af39e45b2 100644
--- a/install/ui/test/data/permission_show_subtree.json
+++ b/install/ui/test/data/permission_show_subtree.json
@@ -8,13 +8,17 @@
"businesscategory": "rscwo",
"cn": "rscwo",
"description": "rscwo",
+ "filter": "rscwo",
"member": "rscwo",
"nsaccountlock": "rscwo",
"o": "rscwo",
"objectclass": "rscwo",
"ou": "rscwo",
"owner": "rscwo",
- "seealso": "rscwo"
+ "seealso": "rscwo",
+ "subtree": "rscwo",
+ "targetgroup": "rscwo",
+ "type": "rscwo"
},
"cn": [
"subtree"
diff --git a/install/ui/test/data/permission_show_type.json b/install/ui/test/data/permission_show_type.json
index 5407ed29c..4ddbcfa68 100644
--- a/install/ui/test/data/permission_show_type.json
+++ b/install/ui/test/data/permission_show_type.json
@@ -8,13 +8,17 @@
"businesscategory": "rscwo",
"cn": "rscwo",
"description": "rscwo",
+ "filter": "rscwo",
"member": "rscwo",
"nsaccountlock": "rscwo",
"o": "rscwo",
"objectclass": "rscwo",
"ou": "rscwo",
"owner": "rscwo",
- "seealso": "rscwo"
+ "seealso": "rscwo",
+ "subtree": "rscwo",
+ "targetgroup": "rscwo",
+ "type": "rscwo"
},
"attrs": [
"unmatched",
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 2a3b952b0..e9fffaf19 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -66,6 +66,7 @@ IPA.widget = function(spec) {
that.valid = true;
that.dirty_changed = IPA.observer();
+ that.value_changed = IPA.observer();
var init = function() {
if (!that.metadata && that.entity) {
@@ -820,7 +821,6 @@ IPA.checkbox_widget = function (spec) {
// default value
that.checked = spec.checked || false;
- that.value_changed = IPA.observer();
that.create = function(container) {
@@ -1109,6 +1109,7 @@ IPA.select_widget = function(spec) {
that.select = $('select[name="'+that.name+'"]', that.container);
that.select.change(function() {
that.set_dirty(that.test_dirty());
+ that.value_changed.notify(that.save(), that);
});
that.create_error_link(container);
@@ -1141,7 +1142,7 @@ IPA.select_widget = function(spec) {
};
that.clear = function() {
- that.empty();
+ $('option', that.select).attr('selected', '');
};
// methods that should be invoked by subclasses
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index ec17d5a8b..4c64527e9 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -346,14 +346,10 @@ class i18n_messages(Command):
"identity": _("Netgroup Settings"),
},
"permission": {
- "filter": _("Filter"),
"identity": _("Identity"),
"invalid_target": _("Permission with invalid target specification"),
"rights": _("Rights"),
- "subtree": _("By Subtree"),
"target": _("Target"),
- "targetgroup": _("Target Group"),
- "type": _("Object By Type"),
},
"privilege": {
"identity": _("Privilege Settings"),