Re: [Freeipa-devel] [PATCH] 115 Reworked netgroup Web UI to allow setting user/host category

2012-04-10 Thread Petr Vobornik

On 04/05/2012 04:54 PM, Endi Sukma Dewata wrote:

On 3/29/2012 7:46 AM, Petr Vobornik wrote:

This patch is changing netgroup web ui to look more like hbac or sudo
rule UI. This change allows to define and display user category, host
category and external host.

The core of the change is changing member attributes (user, group, host,
hostgroup) to use rule_details_widget instead of separate association
facets. In host case it also allows to display and add external hosts.

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

Note: compare to other plugins (HBAC, Sudo) netgroup plugins doesn't
have member attrs in takes_param therefore labels for columns have to be
explicitly set.


ACK.


Pushed to master, ipa-2-2.



Just one thing, the label for user/host category says User/host
category the rule applies to. Netgroup is not a rule, so it might be
better to say something like User/host category of netgroup members or
Member user/host category. This is an existing server issue.




--
Petr Vobornik

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


Re: [Freeipa-devel] [PATCH] 115 Reworked netgroup Web UI to allow setting user/host category

2012-04-05 Thread Endi Sukma Dewata

On 3/29/2012 7:46 AM, Petr Vobornik wrote:

This patch is changing netgroup web ui to look more like hbac or sudo
rule UI. This change allows to define and display user category, host
category and external host.

The core of the change is changing member attributes (user, group, host,
hostgroup) to use rule_details_widget instead of separate association
facets. In host case it also allows to display and add external hosts.

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

Note: compare to other plugins (HBAC, Sudo) netgroup plugins doesn't
have member attrs in takes_param therefore labels for columns have to be
explicitly set.


ACK.

Just one thing, the label for user/host category says User/host 
category the rule applies to. Netgroup is not a rule, so it might be 
better to say something like User/host category of netgroup members or 
Member user/host category. This is an existing server issue.


--
Endi S. Dewata

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


[Freeipa-devel] [PATCH] 115 Reworked netgroup Web UI to allow setting user/host category

2012-03-29 Thread Petr Vobornik
This patch is changing netgroup web ui to look more like hbac or sudo 
rule UI. This change allows to define and display user category, host 
category and external host.


The core of the change is changing member attributes (user, group, host, 
hostgroup) to use rule_details_widget instead of separate association 
facets. In host case it also allows to display and add external hosts.


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

Note: compare to other plugins (HBAC, Sudo) netgroup plugins doesn't 
have member attrs in takes_param therefore labels for columns have to be 
explicitly set.


--
Petr Vobornik
From 2cfc983b882f7b86d82142f583ec3dca27617e34 Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Wed, 28 Mar 2012 17:53:17 +0200
Subject: [PATCH] Reworked netgroup Web UI to allow setting user/host category

This patch is changing netgroup web ui to look more like hbac or sudo rule UI. This change allows to define and display user category, host category and external host.

The core of the change is changing member attributes (user, group, host, hostgroup) to use rule_details_widget instead of separate association facets. In host case it allows to display and add external hosts.

https://fedorahosted.org/freeipa/ticket/2578
---
 install/ui/netgroup.js |  273 
 install/ui/test/data/ipa_init.json |   13 ++-
 ipalib/plugins/internal.py |   11 ++
 3 files changed, 265 insertions(+), 32 deletions(-)

diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js
index d54fdfd52eb943c3f35f65fd3e75ab994836ee12..05f9d0ddc9c6a35b3b63275d6137fd6bff74f3d3 100644
--- a/install/ui/netgroup.js
+++ b/install/ui/netgroup.js
@@ -22,7 +22,10 @@
 
 /* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
 
-IPA.netgroup = {};
+IPA.netgroup = {
+remove_method_priority: IPA.config.default_priority - 1,
+enable_priority: IPA.config.default_priority + 1
+};
 
 IPA.netgroup.entity = function(spec) {
 
@@ -31,42 +34,17 @@ IPA.netgroup.entity = function(spec) {
 that.init = function() {
 that.entity_init();
 
-that.builder.search_facet({
+that.builder.facet_groups(['settings', 'member', 'memberof']).
+search_facet({
 columns: [
 'cn',
 'description'
 ]
 }).
 details_facet({
-sections: [
-{
-name: 'identity',
-fields: [
-'cn',
-{
-type: 'textarea',
-name: 'description'
-},
-'nisdomainname'
-]
-}
-]
-}).
-association_facet({
-name: 'memberhost_host',
-facet_group: 'member'
-}).
-association_facet({
-name: 'memberhost_hostgroup',
-facet_group: 'member'
-}).
-association_facet({
-name: 'memberuser_user',
-facet_group: 'member'
-}).
-association_facet({
-name: 'memberuser_group',
-facet_group: 'member'
+factory: IPA.netgroup.details_facet,
+entity: that,
+command_mode: 'info'
 }).
 association_facet({
 name: 'memberof_netgroup',
@@ -87,4 +65,237 @@ IPA.netgroup.entity = function(spec) {
 return that;
 };
 
+IPA.netgroup.details_facet = function(spec) {
+
+var entity_name = spec.entity.name;
+
+//
+// Identity
+//
+
+spec.fields = [
+{
+name: 'cn',
+widget: 'identity.cn'
+},
+{
+type: 'textarea',
+name: 'description',
+widget: 'identity.description'
+},
+{
+name: 'nisdomainname',
+widget: 'identity.nisdomainname'
+}
+];
+
+spec.widgets = [
+{
+type: 'details_table_section',
+name: 'identity',
+label: IPA.messages.details.general,
+widgets: [
+{
+name: 'cn'
+},
+{
+type: 'textarea',
+name: 'description'
+},
+{
+name: 'nisdomainname',
+widget: 'general.nisdomainname'
+}
+]
+}
+];
+
+//
+// Users
+//
+
+spec.fields.push(
+{
+type: 'radio',
+name: 'usercategory',
+widget: 'user.rule.usercategory'
+},
+{
+type: 'rule_association_table',
+name: 'memberuser_user',
+widget: 'user.rule.memberuser_user',
+priority: IPA.netgroup.remove_method_priority
+},
+{
+type: