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: