Hi,

Please review the attached patch. Thanks.

The Makefile.am and index.xhtml has been modified to include
rolegroup.js. The webui.js has been modified to register the
rolegroup tab.

The rolegroup.js defines the rolegroup's search, add, and details
pages. Sample data for some rolegroup operations have been added.

--
Endi S. Dewata
>From 09cc9d1ceb6259472739afdc767cc502ff9f2484 Mon Sep 17 00:00:00 2001
From: Endi Sukma Dewata <edew...@redhat.com>
Date: Mon, 20 Sep 2010 20:05:03 -0400
Subject: [PATCH] Rolegroups tab.

The Makefile.am and index.xhtml has been modified to include
rolegroup.js. The webui.js has been modified to register the
rolegroup tab.

The rolegroup.js defines the rolegroup's search, add, and details
pages. Sample data for some rolegroup operations have been added.
---
 install/static/Makefile.am                         |    1 +
 install/static/index.xhtml                         |    1 +
 install/static/rolegroup.js                        |  111 ++++++++++++
 install/static/sampledata/rolegroup_add.json       |   22 +++
 .../static/sampledata/rolegroup_add_member.json    |   27 +++
 install/static/sampledata/rolegroup_del.json       |    9 +
 install/static/sampledata/rolegroup_find.json      |  185 ++++++++++++++++++++
 .../static/sampledata/rolegroup_remove_member.json |   24 +++
 install/static/sampledata/rolegroup_show.json      |   20 ++
 install/static/webui.js                            |    1 +
 10 files changed, 401 insertions(+), 0 deletions(-)
 create mode 100644 install/static/rolegroup.js
 create mode 100644 install/static/sampledata/rolegroup_add.json
 create mode 100644 install/static/sampledata/rolegroup_add_member.json
 create mode 100644 install/static/sampledata/rolegroup_del.json
 create mode 100644 install/static/sampledata/rolegroup_find.json
 create mode 100644 install/static/sampledata/rolegroup_remove_member.json
 create mode 100644 install/static/sampledata/rolegroup_show.json

diff --git a/install/static/Makefile.am b/install/static/Makefile.am
index 9bd327c..7d7c27d 100644
--- a/install/static/Makefile.am
+++ b/install/static/Makefile.am
@@ -28,6 +28,7 @@ app_DATA =                              \
 	navigation.js			\
 	netgroup.js 			\
 	service.js 			\
+	rolegroup.js 			\
 	search.js 			\
 	details.js 			\
 	entity.js 			\
diff --git a/install/static/index.xhtml b/install/static/index.xhtml
index 98e2495..3fcb5f6 100644
--- a/install/static/index.xhtml
+++ b/install/static/index.xhtml
@@ -25,6 +25,7 @@
     <script type="text/javascript" src="hostgroup.js"></script>
     <script type="text/javascript" src="netgroup.js"></script>
     <script type="text/javascript" src="service.js"></script>
+    <script type="text/javascript" src="rolegroup.js"></script>
 
     <script type="text/javascript" src="develop.js"></script>
     <script type="text/javascript" src="webui.js"></script>
diff --git a/install/static/rolegroup.js b/install/static/rolegroup.js
new file mode 100644
index 0000000..2e52f10
--- /dev/null
+++ b/install/static/rolegroup.js
@@ -0,0 +1,111 @@
+/*  Authors:
+ *    Endi Sukma Dewata <edew...@redhat.com>
+ *
+ * Copyright (C) 2010 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 only
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+
+ipa_entity_set_search_definition('rolegroup', [
+    ['cn', 'Role-group name', null],
+    ['description', 'Description', null],
+    ['quick_links', 'Quick Links', rolegroup_render_quick_links]
+]);
+
+ipa_entity_set_add_definition('rolegroup', [
+    'dialog-add-rolegroup', 'Add New Rolegroup', [
+        ['cn', 'Name', null],
+        ['description', 'Description', null],
+    ]
+]);
+
+ipa_entity_set_details_definition('rolegroup', [
+    ['identity', 'Rolegroup Details', [
+        ['cn', 'Name', null],
+        ['description', 'Description', null],
+    ]]
+]);
+
+function rolegroup_render_quick_links(tr, attr, value, entry_attrs) {
+
+    var td = $("<td/>");
+    tr.append(td);
+
+    $("<a/>", {
+        href: "jslink",
+        html: $("<img src='rolegroup_details.png' />"),
+        click: function() {
+            var state = {};
+            state['rolegroup-facet'] = 'details';
+            state['rolegroup-pkey'] = entry_attrs['cn'][0];
+            $.bbq.pushState(state);
+            return false;
+        }
+    }).appendTo(td);
+
+    $("<a/>", {
+        href: "jslink",
+        html: $("<img src='user_member.png' />"),
+        click: function() {
+            var state = {};
+            state['rolegroup-facet'] = 'associate';
+            state['rolegroup-enroll'] = 'user';
+            state['rolegroup-pkey'] = entry_attrs['cn'][0];
+            $.bbq.pushState(state);
+            return false;
+        }
+    }).appendTo(td);
+
+    $("<a/>", {
+        href: "jslink",
+        html: $("<img src='group_member.png' />"),
+        click: function() {
+            var state = {};
+            state['rolegroup-facet'] = 'associate';
+            state['rolegroup-enroll'] = 'group';
+            state['rolegroup-pkey'] = entry_attrs['cn'][0];
+            $.bbq.pushState(state);
+            return false;
+        }
+    }).appendTo(td);
+
+    $("<a/>", {
+        href: "jslink",
+        html: $("<img src='host_member.png' />"),
+        click: function() {
+            var state = {};
+            state['rolegroup-facet'] = 'associate';
+            state['rolegroup-enroll'] = 'host';
+            state['rolegroup-pkey'] = entry_attrs['cn'][0];
+            $.bbq.pushState(state);
+            return false;
+        }
+    }).appendTo(td);
+
+    $("<a/>", {
+        href: "jslink",
+        html: $("<img src='hostgroup_member.png' />"),
+        click: function() {
+            var state = {};
+            state['rolegroup-facet'] = 'associate';
+            state['rolegroup-enroll'] = 'hostgroup';
+            state['rolegroup-pkey'] = entry_attrs['cn'][0];
+            $.bbq.pushState(state);
+            return false;
+        }
+    }).appendTo(td);
+}
diff --git a/install/static/sampledata/rolegroup_add.json b/install/static/sampledata/rolegroup_add.json
new file mode 100644
index 0000000..54e2c28
--- /dev/null
+++ b/install/static/sampledata/rolegroup_add.json
@@ -0,0 +1,22 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "result": {
+            "cn": [
+                "test"
+            ],
+            "description": [
+                "Test role"
+            ],
+            "dn": "cn=test,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+            "objectclass": [
+                "groupofnames",
+                "nestedgroup",
+                "top"
+            ]
+        },
+        "summary": "Added rolegroup \"test\"",
+        "value": "test"
+    }
+}
diff --git a/install/static/sampledata/rolegroup_add_member.json b/install/static/sampledata/rolegroup_add_member.json
new file mode 100644
index 0000000..e68ecc2
--- /dev/null
+++ b/install/static/sampledata/rolegroup_add_member.json
@@ -0,0 +1,27 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "completed": 1,
+        "failed": {
+            "member": {
+                "group": [],
+                "host": [],
+                "hostgroup": [],
+                "user": []
+            }
+        },
+        "result": {
+            "cn": [
+                "test"
+            ],
+            "description": [
+                "Test role"
+            ],
+            "dn": "cn=test,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+            "member_user": [
+                "admin"
+            ]
+        }
+    }
+}
diff --git a/install/static/sampledata/rolegroup_del.json b/install/static/sampledata/rolegroup_del.json
new file mode 100644
index 0000000..8af1e63
--- /dev/null
+++ b/install/static/sampledata/rolegroup_del.json
@@ -0,0 +1,9 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "result": true,
+        "summary": "Deleted rolegroup \"test\"",
+        "value": "test"
+    }
+}
diff --git a/install/static/sampledata/rolegroup_find.json b/install/static/sampledata/rolegroup_find.json
new file mode 100644
index 0000000..8ed2a76
--- /dev/null
+++ b/install/static/sampledata/rolegroup_find.json
@@ -0,0 +1,185 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "count": 15,
+        "result": [
+            {
+                "cn": [
+                    "helpdesk"
+                ],
+                "description": [
+                    "Helpdesk"
+                ],
+                "dn": "cn=helpdesk,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "member_user": [
+                    "edewata"
+                ]
+            },
+            {
+                "cn": [
+                    "useradmin"
+                ],
+                "description": [
+                    "User Administrators"
+                ],
+                "dn": "cn=useradmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "groupadmin"
+                ],
+                "description": [
+                    "Group Administrators"
+                ],
+                "dn": "cn=groupadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "hostadmin"
+                ],
+                "description": [
+                    "Host Administrators"
+                ],
+                "dn": "cn=hostadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "memberof_taskgroup": [
+                    "addhosts",
+                    "removehosts",
+                    "modifyhosts",
+                    "manage_host_keytab",
+                    "enroll_host"
+                ]
+            },
+            {
+                "cn": [
+                    "hostgroupadmin"
+                ],
+                "description": [
+                    "Host Group Administrators"
+                ],
+                "dn": "cn=hostgroupadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "delegationadmin"
+                ],
+                "description": [
+                    "Role administration"
+                ],
+                "dn": "cn=delegationadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "serviceadmin"
+                ],
+                "description": [
+                    "Service Administrators"
+                ],
+                "dn": "cn=serviceadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "memberof_taskgroup": [
+                    "addservices",
+                    "removeservices",
+                    "modifyservices"
+                ]
+            },
+            {
+                "cn": [
+                    "automountadmin"
+                ],
+                "description": [
+                    "Automount Administrators"
+                ],
+                "dn": "cn=automountadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "netgroupadmin"
+                ],
+                "description": [
+                    "Netgroups Administrators"
+                ],
+                "dn": "cn=netgroupadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "dnsadmin"
+                ],
+                "description": [
+                    "DNS Administrators"
+                ],
+                "dn": "cn=dnsadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "dnsserver"
+                ],
+                "description": [
+                    "DNS Servers"
+                ],
+                "dn": "cn=dnsserver,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+            },
+            {
+                "cn": [
+                    "certadmin"
+                ],
+                "description": [
+                    "Certificate Administrators"
+                ],
+                "dn": "cn=certadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "memberof_taskgroup": [
+                    "retrieve_certs",
+                    "request_certs",
+                    "request_cert_different_host",
+                    "certificate_status",
+                    "revoke_certificate",
+                    "certificate_remove_hold"
+                ]
+            },
+            {
+                "cn": [
+                    "replicaadmin"
+                ],
+                "description": [
+                    "Replication Administrators"
+                ],
+                "dn": "cn=replicaadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "member_user": [
+                    "admin"
+                ],
+                "memberof_taskgroup": [
+                    "managereplica",
+                    "deletereplica"
+                ]
+            },
+            {
+                "cn": [
+                    "enrollhost"
+                ],
+                "description": [
+                    "Host Enrollment"
+                ],
+                "dn": "cn=enrollhost,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "memberof_taskgroup": [
+                    "manage_host_keytab",
+                    "enroll_host"
+                ]
+            },
+            {
+                "cn": [
+                    "entitlementadmin"
+                ],
+                "description": [
+                    "Entitlement Administrators"
+                ],
+                "dn": "cn=entitlementadmin,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+                "memberof_taskgroup": [
+                    "addentitlements",
+                    "removeentitlements",
+                    "modifyentitlements"
+                ]
+            }
+        ],
+        "summary": "15 rolegroups matched",
+        "truncated": false
+    }
+}
diff --git a/install/static/sampledata/rolegroup_remove_member.json b/install/static/sampledata/rolegroup_remove_member.json
new file mode 100644
index 0000000..d42bb60
--- /dev/null
+++ b/install/static/sampledata/rolegroup_remove_member.json
@@ -0,0 +1,24 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "completed": 1,
+        "failed": {
+            "member": {
+                "group": [],
+                "host": [],
+                "hostgroup": [],
+                "user": []
+            }
+        },
+        "result": {
+            "cn": [
+                "test"
+            ],
+            "description": [
+                "Test role"
+            ],
+            "dn": "cn=test,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com"
+        }
+    }
+}
diff --git a/install/static/sampledata/rolegroup_show.json b/install/static/sampledata/rolegroup_show.json
new file mode 100644
index 0000000..4652fb2
--- /dev/null
+++ b/install/static/sampledata/rolegroup_show.json
@@ -0,0 +1,20 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "result": {
+            "cn": [
+                "test"
+            ],
+            "description": [
+                "Test role"
+            ],
+            "dn": "cn=test,cn=rolegroups,cn=accounts,dc=dev,dc=example,dc=com",
+            "member_user": [
+                "admin"
+            ]
+        },
+        "summary": null,
+        "value": "test"
+    }
+}
diff --git a/install/static/webui.js b/install/static/webui.js
index 9aaa21d..5e93e18 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -29,6 +29,7 @@ var nav_tabs_lists = [
         ['hostgroup', 'Hostgroups', ipa_entity_setup],
         ['netgroup', 'Netgroups', ipa_entity_setup],
         ['service', 'Services', ipa_entity_setup],
+        ['rolegroup', 'Rolegroups', ipa_entity_setup],
     ]],
     ['policy', 'POLICY', unimplemented_tab],
     ['config', 'CONFIG', unimplemented_tab]
-- 
1.7.2.3

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

Reply via email to