summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-01-03 10:57:59 +0100
committerEndi S. Dewata <edewata@redhat.com>2012-01-11 00:48:36 -0600
commit05345ce8c8007dd3ef708ae9049423937d543c67 (patch)
tree46878d53093042ba87bc7bac250b35742e91c63f
parent9dff149830a31294b10353c26f8a6f5aef133cb3 (diff)
downloadfreeipa-05345ce8c8007dd3ef708ae9049423937d543c67.tar.gz
freeipa-05345ce8c8007dd3ef708ae9049423937d543c67.tar.xz
freeipa-05345ce8c8007dd3ef708ae9049423937d543c67.zip
Added support for memberof attribute in permission
The attribute was added to adder dialog and details facet. It uses entity select (group) widget. https://fedorahosted.org/freeipa/ticket/2101
-rw-r--r--install/ui/aci.js59
-rw-r--r--install/ui/test/aci_tests.js9
2 files changed, 49 insertions, 19 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 2176dc310..badc7953b 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -60,6 +60,11 @@ IPA.aci.permission_entity = function(spec) {
enabled: false
},
{
+ type: 'entity_select',
+ name: 'memberof',
+ widget: 'target.memberof'
+ },
+ {
name: 'subtree',
widget: 'target.subtree',
enabled: false
@@ -87,7 +92,9 @@ IPA.aci.permission_entity = function(spec) {
type: 'details_table_section',
name: 'identity',
label: IPA.messages.objects.permission.identity,
- widgets: ['cn']
+ widgets: [
+ 'cn'
+ ]
},
{
type: 'details_table_section',
@@ -103,7 +110,7 @@ IPA.aci.permission_entity = function(spec) {
{
type: 'permission_target',
container_factory: IPA.details_table_section,
- label: IPA.messages.objects.permission.rights,
+ label: IPA.messages.objects.permission.target,
name: 'target',
show_target: false
}
@@ -140,6 +147,11 @@ IPA.aci.permission_entity = function(spec) {
enabled: false
},
{
+ type: 'entity_select',
+ name: 'memberof',
+ widget: 'target.memberof'
+ },
+ {
name: 'subtree',
widget: 'target.subtree',
enabled: false
@@ -621,6 +633,16 @@ IPA.permission_target_widget = function(spec) {
that.widgets.add_widget(that.target_select);
+ that.memberof_select = IPA.entity_select_widget({
+ entity: that.entity,
+ name: 'memberof',
+ other_entity: that.group_entity,
+ other_field: 'cn',
+ hidden: true
+ });
+
+ that.widgets.add_widget(that.memberof_select);
+
that.filter_text = IPA.text_widget({
entity: that.entity,
name: 'filter',
@@ -717,6 +739,8 @@ IPA.permission_target_policy = function (widget_name) {
var targets = that.permission_target.targets;
+ that.set_target_visible_core('memberof', false);
+
for (var i=0; i<targets.length; i++) {
var target = targets[i];
@@ -736,26 +760,27 @@ IPA.permission_target_policy = function (widget_name) {
that.set_target_visible = function(target, visible) {
- var widgets = that.permission_target.widgets;
- var fields = that.container.fields;
-
- var widget = widgets.get_widget(target);
- widget.hidden = !visible;
- that.permission_target.set_row_visible(target, visible);
-
- var field = fields.get_field(target);
- field.enabled = visible;
+ that.set_target_visible_core(target, visible);
if (target === 'type') {
- widget = widgets.get_widget('attrs');
- widget.hidden = !visible;
- that.permission_target.set_row_visible('attrs', visible);
-
- field = fields.get_field('attrs');
- field.enabled = visible;
+ that.set_target_visible_core('attrs', visible);
} else {
+ var field = that.container.fields.get_field(target);
field.set_required(visible);
}
+
+ if (visible) {
+ var member_of_visible = target === 'type' || target === 'subtree';
+ that.set_target_visible_core('memberof', member_of_visible);
+ }
+ };
+
+ that.set_target_visible_core = function(target, visible) {
+ var widget = that.permission_target.widgets.get_widget(target);
+ var field = that.container.fields.get_field(target);
+ that.permission_target.set_row_visible(target, visible);
+ field.enabled = visible;
+ widget.hidden = !visible;
};
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index e166aa3dc..03e891c00 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -49,6 +49,11 @@ module('aci', {
enabled: false
},
{
+ type: 'entity_select',
+ name: 'memberof',
+ widget: 'target.memberof'
+ },
+ {
name: 'subtree',
widget: 'target.subtree',
enabled: false
@@ -224,7 +229,7 @@ test("Testing type target.", function() {
same(record.type[0], data.result.result.type,
"saved type matches sample data");
- same(get_visible_rows(target_widget), ['type', 'attrs'],
+ same(get_visible_rows(target_widget), ['memberof', 'type', 'attrs'],
'type and attrs rows visible');
ok((record.attrs.length > 10),
@@ -268,7 +273,7 @@ test("Testing subtree target.", function() {
same(record.subtree[0], data.result.result.subtree, 'subtree set correctly');
- same(get_visible_rows(target_widget), ['subtree'], 'subtree row visible');
+ same(get_visible_rows(target_widget), ['memberof', 'subtree'], 'subtree row visible');
});