On 01/04/2012 07:03 PM, Endi Sukma Dewata wrote:
On 1/3/2012 6:20 AM, Petr Vobornik wrote:
The attribute was added to adder dialog and details facet. It uses
entity select(group) widget.
https://fedorahosted.org/freeipa/ticket/2101
Proper functionality of this patch depends on ticket #2100 - Rob's patch
912.
Also fixing one label regression.
I think the memberof is one of possible permission targets, so it should
be added into the IPA.permission_target_widget. The memberof drop-down
list should appear only when you select memberof as the target.
Updated patch attached.
Modified according to discussion for patch 912:
To reflect the correct possible combinations, we probably should move the
'Member of group' field somewhere below the 'Target' drop-down list and show it
only when 'Type' or 'Subtree' is selected. If we keep option #4b then we should
also show it when the 'Target group' is selected.
Also memberof is not visible for target=='targetgroup'
https://fedorahosted.org/freeipa/ticket/2222
--
Petr Vobornik
From 78d7ebd51d4764058e519a183ca8ae997cf6ba37 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 3 Jan 2012 10:57:59 +0100
Subject: [PATCH] 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
---
install/ui/aci.js | 59 +++++++++++++++++++++++++++++------------
install/ui/test/aci_tests.js | 9 +++++-
2 files changed, 49 insertions(+), 19 deletions(-)
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 2176dc31005ae28a84333b0883611c483f60290e..badc7953b51a7c026460098076c8fe9af187d7b2 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 e166aa3dc895a5b1bf7974c8231b373335a2ca7b..03e891c002397c2d3f536a57063ebf921b584375 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');
});
--
1.7.6.4
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel