Re: [Freeipa-devel] [PATCH] 186-192 Web UI: Group external member support

2012-08-13 Thread Martin Kosek
On 08/14/2012 12:50 AM, Endi Sukma Dewata wrote:
> On 8/10/2012 6:04 AM, Petr Vobornik wrote:
>> Attaching all patches. Patches 186-189 are changed or rebased. Rest is
>> intact.
> 
> ACK.
> 

Pushed all to master.

Martin

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 186-192 Web UI: Group external member support

2012-08-13 Thread Endi Sukma Dewata

On 8/10/2012 6:04 AM, Petr Vobornik wrote:

Attaching all patches. Patches 186-189 are changed or rebased. Rest is
intact.


ACK.

--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 186-192 Web UI: Group external member support

2012-08-10 Thread Petr Vobornik

On 08/06/2012 10:14 PM, Endi Sukma Dewata wrote:

ACK.


Attaching all patches. Patches 186-189 are changed or rebased. Rest is 
intact.




The patches work, but I have some comments:

1. Would it be better to use radio buttons to define mutually exclusive
options? Something like this:

   Group type: (o) Normal
   ( ) External
   ( ) POSIX
   GID: []


Patch 186 reworked.



2. If you decide to use radio buttons for the adder dialog you might
want to use similar layout in the details page.


Patch 189 reworked.



3. Minor thing, the "posix" in "Change to posix group" probably should
be capitalized to be consistent with the "POSIX group" field label. Feel
free to fix before push.


Fixed.



4. I don't have the environment to test patch #192 but the code looks fine.

5. I noticed this problem, but I couldn't reproduce it anymore. When I
specified a GID in the group adder dialog, the value seemed to be
ignored, so the GID would always be generated. Also the GID wasn't
validated. Probably just a glitch.


I didn't notice it.

--
Petr Vobornik


From ec010b95e19e8b1e0e49c0d1737e04d9b3ddd2b4 Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Mon, 30 Jul 2012 13:31:11 +0200
Subject: [PATCH] Add external group

Group can be normal, posix and external. Posix checkbox was removed and was replaced by radio for selecting group type. This adds possibility of adding of external group.

https://fedorahosted.org/freeipa/ticket/2895
---
 install/ui/group.js|   72 ++--
 install/ui/test/data/ipa_init.json |5 ++-
 ipalib/plugins/internal.py |5 ++-
 3 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/install/ui/group.js b/install/ui/group.js
index 5ad9ba1f1d887c1297573a90c209ace00e3f3a86..ad26676ab245405127a1a0e931183f1688bfcbc0 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -111,10 +111,25 @@ IPA.group.entity = function(spec) {
 name: 'description'
 },
 {
-type: 'nonposix_checkbox',
-name: 'nonposix',
-label: IPA.messages.objects.group.posix,
-checked: true
+type: 'radio',
+name: 'type',
+label: IPA.messages.objects.group.type,
+flags: ['no_command'],
+default_value: 'normal',
+options: [
+{
+value: 'normal',
+label: IPA.messages.objects.group.normal
+},
+{
+value: 'external',
+label: IPA.messages.objects.group.external
+},
+{
+value: 'posix',
+label: IPA.messages.objects.group.posix
+}
+]
 },
 'gidnumber'
 ]
@@ -124,24 +139,6 @@ IPA.group.entity = function(spec) {
 return that;
 };
 
-IPA.group_nonposix_checkbox_widget = function (spec) {
-
-spec = spec || {};
-
-var that = IPA.checkbox_widget(spec);
-
-that.save = function() {
-var value = that.checkbox_save()[0];
-// convert posix into non-posix
-return [!value];
-};
-
-return that;
-};
-
-IPA.widget_factories['nonposix_checkbox'] = IPA.group_nonposix_checkbox_widget;
-IPA.field_factories['nonposix_checkbox'] = IPA.checkbox_field;
-
 IPA.group_adder_dialog = function(spec) {
 
 spec = spec || {};
@@ -150,17 +147,38 @@ IPA.group_adder_dialog = function(spec) {
 
 var init = function() {
 
-var posix_field = that.fields.get_field('nonposix');
-posix_field.widget.value_changed.attach(that.on_posix_change);
+var type_field = that.fields.get_field('type');
+type_field.widget.value_changed.attach(that.on_type_change);
 };
 
-that.on_posix_change = function (value) {
+that.on_type_change = function(value) {
 
 var gid_field = that.fields.get_field('gidnumber');
-if (value[0]) {
+var external_field = that.fields.get_field('external');
+
+var posix = value[0] === 'posix';
+
+if (!posix) {
 gid_field.reset();
 }
-gid_field.set_enabled(!value[0]);
+
+gid_field.set_enabled(posix);
+};
+
+that.create_add_command = function(record) {
+
+var command = that.entity_adder_dialog_create_add_command(record);
+
+var type_field = that.fields.get_field('type');
+var type = type_field.save()[0];
+
+if (type === 'normal') {
+command.set_option('nonposix', true);
+} else if (type === 'external') {
+command.set_option('external', true);
+}
+
+return command;
 };
 
 init

Re: [Freeipa-devel] [PATCH] 186-192 Web UI: Group external member support

2012-08-06 Thread Endi Sukma Dewata

ACK.

The patches work, but I have some comments:

1. Would it be better to use radio buttons to define mutually exclusive 
options? Something like this:


  Group type: (o) Normal
  ( ) External
  ( ) POSIX
  GID: []

2. If you decide to use radio buttons for the adder dialog you might 
want to use similar layout in the details page.


3. Minor thing, the "posix" in "Change to posix group" probably should 
be capitalized to be consistent with the "POSIX group" field label. Feel 
free to fix before push.


4. I don't have the environment to test patch #192 but the code looks fine.

5. I noticed this problem, but I couldn't reproduce it anymore. When I 
specified a GID in the group adder dialog, the value seemed to be 
ignored, so the GID would always be generated. Also the GID wasn't 
validated. Probably just a glitch.


--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 186-192 Web UI: Group external member support

2012-08-03 Thread Petr Vobornik

[PATCH] 186 Add external group

Added new option to group adder dialog for defining external group. 
Posix group and external group are mutually exclusive.


https://fedorahosted.org/freeipa/ticket/2895

[PATCH] 187 Make group external

New action for creating plain group external. Posix group can't be made 
external.


https://fedorahosted.org/freeipa/ticket/2895

[PATCH] 188 Make group posix

New option for creating plain user group posix group. External group 
can't be made posix.


https://fedorahosted.org/freeipa/ticket/2338

[PATCH] 189 Display group type

Added two fields to group details facet to display whether a group is 
external or posix. The decision is based on group's objectclass.


https://fedorahosted.org/freeipa/ticket/2895

[PATCH] 190 Attribute facet

Created new type of facet: attribute facet. This facet is similar to 
association facet but it serves for displaying object's multivalued 
attributes which behaves like association attributes. It will serve as a 
basis for displaying group's externalmember attribute.


https://fedorahosted.org/freeipa/ticket/2895

[PATCH] 191 Group external member facet

Added 'external' attribute facet to group entity. It serves for 
displaying group's externalmember attribute.


https://fedorahosted.org/freeipa/ticket/2895

[PATCH] 192 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
--
Petr Vobornik

From c12ffdbbd3121e2577d82398723e5f7848b2eee7 Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Mon, 30 Jul 2012 13:31:11 +0200
Subject: [PATCH] Add external group

Added new option to group adder dialog for defining external group. Posix group and external group are mutually exclusive.

https://fedorahosted.org/freeipa/ticket/2895
---
 install/ui/group.js|   21 +
 install/ui/test/data/ipa_init.json |1 +
 ipalib/plugins/internal.py |1 +
 3 files changed, 23 insertions(+)

diff --git a/install/ui/group.js b/install/ui/group.js
index 5ad9ba1f1d887c1297573a90c209ace00e3f3a86..9bad142809ea8744ddf0561b53e27953859aad53 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -111,6 +111,11 @@ IPA.group.entity = function(spec) {
 name: 'description'
 },
 {
+type: 'checkbox',
+name: 'external',
+label: IPA.messages.objects.group.external
+},
+{
 type: 'nonposix_checkbox',
 name: 'nonposix',
 label: IPA.messages.objects.group.posix,
@@ -151,18 +156,34 @@ IPA.group_adder_dialog = function(spec) {
 var init = function() {
 
 var posix_field = that.fields.get_field('nonposix');
+var external_field = that.fields.get_field('external');
 posix_field.widget.value_changed.attach(that.on_posix_change);
+external_field.widget.value_changed.attach(that.on_external_change);
 };
 
 that.on_posix_change = function (value) {
 
 var gid_field = that.fields.get_field('gidnumber');
+var external_field = that.fields.get_field('external');
 if (value[0]) {
 gid_field.reset();
 }
+external_field.reset();
 gid_field.set_enabled(!value[0]);
 };
 
+that.on_external_change = function (value) {
+
+var gid_field = that.fields.get_field('gidnumber');
+var posix_field = that.fields.get_field('nonposix');
+
+if (value[0]) {
+posix_field.widget.update([false]);
+gid_field.reset();
+gid_field.set_enabled(false);
+}
+};
+
 init();
 
 return that;
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 4325a5552e1205a3839e5830c59af73448785789..111fb88e495b90b477613cc6a4593596b505002e 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -268,6 +268,7 @@
 },
 "group": {
 "details": "Group Settings",
+"external": "External",
 "posix": "POSIX group"
 },
 "hbacrule": {
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 08d7a255f322e8391ee81aeaced660363d8078c4..7e046781279ebf140e8447ec8848f9d4c4d50849 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -405,6 +405,7 @@ class i18n_messages(Command):
 },
 "group": {
 "details": _("Group Settings"),
+"external": _("External"),
 "posix": _("POSIX group"),
 },
 "hbacrule": {
-- 
1.7.10.4

From e4bbd554110dc24bcc3dea1c51deb