In current implementation target facet of navigation(from menu) and redirection is always one exact facet per entity. There isn't a way to navigate to different facet from menu or redirect to different facets from various facets.

This patch adds:
* possibility to define menu items which can navigate to different facets of various entities. This also means that now current menu tree can contain leafs with the same entity. * possibility to define redirection target per facet - it is needed to keep breadcrumb navigation consistent with various navigation tree patch leading leafs with same entity.


This functionality is needed for Automember UI. Automember UI is designed as if it was for two entities but it is in fact only one.

Note: attaching early (missing a lot of stuff) WIP patch of Automember UI to illustrate usage of this patch.

https://fedorahosted.org/freeipa/ticket/2195
--
Petr Vobornik
From 38d25608c4801cd9edd2273384c462c8a51a757c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Voborn=C3=ADk?= <pvobo...@redhat.com>
Date: Fri, 27 Jan 2012 17:20:25 +0100
Subject: [PATCH] Navigation and redirection to various facets

In current implementation target facet of navigation(from menu) and redirection is always one exact facet per entity. There isn't a way to navigate to different facet from menu or redirect to different facets from various facets.

This patch adds:
 * possibility to define menu items which can navigate to different facets of various entities. This also means that now current menu tree can contain leafs with the same entity.
 * possibility to define redirection target per facet - it is needed to keep breadcrumb navigation consistent with various navigation tree patch leading to same entity leafs.

This functionality is needed for Automember UI. Automember UI is designed as if it was for two entities but it is in fact only one.

https://fedorahosted.org/freeipa/ticket/2195
---
 install/ui/entity.js     |    5 ++-
 install/ui/facet.js      |   79 ++++++++++++++++++++++++++++++----------------
 install/ui/navigation.js |   44 +++++++++++++++++++++++--
 3 files changed, 95 insertions(+), 33 deletions(-)

diff --git a/install/ui/entity.js b/install/ui/entity.js
index acfc9c44034c7ba7d9504c4d51e422d6ab426903..6b2be9e6661b2d157a62c5bc8bb6a0fd7847699f 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -377,7 +377,7 @@ IPA.entity_builder = function() {
 
         that.facet(spec);
 
-        add_redirect_info();
+        add_redirect_info(spec.name);
 
         return that;
     };
@@ -487,8 +487,9 @@ IPA.entity_builder = function() {
     }
 
     function add_redirect_info(facet_name){
+        facet_name = facet_name || 'search';
         if (!entity.redirect_facet){
-            entity.redirect_facet = 'search';
+            entity.redirect_facet = facet_name;
         }
     }
 
diff --git a/install/ui/facet.js b/install/ui/facet.js
index 150c3e8faad29381372c31358ea928db14c0be0c..ecb76760368ef9182480bf7075e7fe78bcc770b6 100644
--- a/install/ui/facet.js
+++ b/install/ui/facet.js
@@ -36,6 +36,7 @@ IPA.facet = function(spec) {
     that.name = spec.name;
     that.label = spec.label;
     that.title = spec.title || that.label;
+    that.tab_label = spec.tab_label || that.label;
     that.display_class = spec.display_class;
 
     that.disable_breadcrumb = spec.disable_breadcrumb;
@@ -50,6 +51,8 @@ IPA.facet = function(spec) {
     // facet group name
     that.facet_group = spec.facet_group;
 
+    that.redirect_info = spec.redirect_info;
+
     that.state = {};
 
     that.get_dialog = function(name) {
@@ -132,15 +135,39 @@ IPA.facet = function(spec) {
         that.content.append('<p>'+error_thrown.message+'</p>');
     };
 
-    that.redirect = function() {
+    that.get_redirect_facet = function() {
+
         var entity = that.entity;
         while (entity.containing_entity) {
             entity = entity.get_containing_entity();
         }
+        var facet_name = that.entity.redirect_facet;
+        var entity_name = entity.name;
+        var tab_name, facet;
 
-        IPA.nav.show_page(
-            entity.name,
-            that.entity.redirect_facet);
+        if (that.redirect_info) {
+            entity_name = that.redirect_info.entity || entity_name;
+            facet_name = that.redirect_info.facet || facet_name;
+            tab_name = that.redirect_info.tab;
+        }
+
+        if (tab_name) {
+            facet = IPA.nav.get_tab_facet(tab_name);
+        }
+
+        if (!facet) {
+            entity = IPA.get_entity(entity_name);
+            facet = entity.get_facet(facet_name);
+        }
+
+        return facet;
+    };
+
+    that.redirect = function() {
+
+        var facet = that.get_redirect_facet();
+        if (!facet) return;
+        IPA.nav.show_page(facet.entity.name, facet.name);
     };
 
     var redirect_error_codes = [4001];
@@ -149,12 +176,10 @@ IPA.facet = function(spec) {
 
         /*If the error is in talking to the server, don't attempt to redirect,
           as there is nothing any other facet can do either. */
-        if (that.entity.redirect_facet) {
-            for (var i=0; i<redirect_error_codes.length; i++) {
-                if (error_thrown.code === redirect_error_codes[i]) {
-                    that.redirect();
-                    return;
-                }
+        for (var i=0; i<redirect_error_codes.length; i++) {
+            if (error_thrown.code === redirect_error_codes[i]) {
+                that.redirect();
+                return;
             }
         }
     };
@@ -244,7 +269,7 @@ IPA.facet_header = function(spec) {
 
         that.title_container.empty();
         var h3 = $('<h3/>').appendTo(that.title_container);
-        h3.append(that.facet.title);
+        h3.append(that.facet.label);
         h3.append(': ');
 
         $('<span/>', {
@@ -272,7 +297,7 @@ IPA.facet_header = function(spec) {
         }).appendTo(container);
 
         $('<a/>', {
-            text: other_facet.label,
+            text: other_facet.tab_label,
             id: other_facet.name
         }).appendTo(li);
     };
@@ -310,13 +335,10 @@ IPA.facet_header = function(spec) {
                 'class': 'back-link'
             }).appendTo(that.breadcrumb);
 
-            var entity = that.facet.entity;
-            while (entity.containing_entity) {
-                entity = entity.get_containing_entity();
-            }
+            var redirect_facet = that.facet.get_redirect_facet();
 
             $('<a/>', {
-                text: entity.metadata.label,
+                text: redirect_facet.label,
                 click: function() {
                     that.facet.redirect();
                     return false;
@@ -334,7 +356,7 @@ IPA.facet_header = function(spec) {
         }).appendTo(container);
 
         var span = $('<h3/>', {
-            text: that.facet.entity.label
+            text: that.facet.label
         }).appendTo(that.title_container);
 
         if (!that.facet.disable_facet_tabs) {
@@ -384,9 +406,9 @@ IPA.facet_header = function(spec) {
 
                     var values = result ? result[facet.name] : null;
                     if (values) {
-                        link.text(facet.label+' ('+values.length+')');
+                        link.text(facet.tab_label+' ('+values.length+')');
                     } else {
-                        link.text(facet.label);
+                        link.text(facet.tab_label);
                     }
                 }
             }
@@ -415,6 +437,7 @@ IPA.table_facet = function(spec) {
 
     that.row_enabled_attribute = spec.row_enabled_attribute;
     that.row_disabled_attribute = spec.row_disabled_attribute;
+    that.details_facet_name = spec.details_facet || 'default';
 
     that.columns = $.ordered_map();
 
@@ -701,7 +724,7 @@ IPA.table_facet = function(spec) {
 
             if (column.link && column.primary_key) {
                 column.link_handler = function(value) {
-                    IPA.nav.show_page(entity.name, 'default', value);
+                    IPA.nav.show_page(entity.name, that.details_facet_name, value);
                     return false;
                 };
             }
@@ -834,7 +857,8 @@ IPA.facet_builder = function(entity) {
     that.prepare_search_spec = function(spec) {
 
         spec.title = spec.title || entity.metadata.label;
-        spec.label = spec.label || IPA.messages.facets.search;
+        spec.label = spec.label || entity.metadata.label;
+        spec.tab_label = spec.tab_label || IPA.messages.facets.search;
         spec.factory = spec.factory || IPA.search_facet;
 
         add_redirect_info();
@@ -844,7 +868,8 @@ IPA.facet_builder = function(entity) {
     that.prepare_nested_search_spec = function(spec) {
 
         spec.title = spec.title || entity.metadata.label_singular;
-        spec.label = spec.label || IPA.messages.facets.search;
+        spec.label = spec.label || entity.metadata.label;
+        spec.tab_label = spec.tab_label || IPA.messages.facets.search;
         spec.factory = spec.factory || IPA.nested_search_facet;
 
         return spec;
@@ -852,7 +877,8 @@ IPA.facet_builder = function(entity) {
 
     that.prepare_details_spec = function(spec) {
         spec.title = spec.title || entity.metadata.label_singular;
-        spec.label = spec.label || IPA.messages.facets.details;
+        spec.label = spec.label || entity.metadata.label_singular;
+        spec.tab_label = spec.tab_label || IPA.messages.facets.details;
         spec.factory = spec.factory || IPA.details_facet;
 
         return spec;
@@ -875,9 +901,8 @@ IPA.facet_builder = function(entity) {
 
         spec.factory = spec.factory || IPA.association_facet;
 
-        spec.title = spec.label || entity.metadata.label_singular;
-
-        spec.label = spec.label ||
+        spec.label = spec.label || entity.metadata.label_singular;
+        spec.tab_label = spec.tab_label ||
             (IPA.metadata.objects[spec.other_entity] ?
             IPA.metadata.objects[spec.other_entity].label : spec.other_entity);
 
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 84df7f4daf2fb342f54ff2427cafe1b422789639..72c91426803661ee26ee794f1f16ffcde6393459 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -191,7 +191,7 @@ IPA.navigation = function(spec) {
 
         // push entity path and facet state
         state = {};
-        $.extend(state, that.get_path_state(tab.entity.name));
+        $.extend(state, that.get_path_state(tab.name));
         $.extend(state, facet.state);
         $.bbq.pushState(state, 2);
 
@@ -206,6 +206,26 @@ IPA.navigation = function(spec) {
         $.bbq.removeState(key);
     };
 
+    that.show_tab = function(tab_name, pkey) {
+
+        var tab = that.get_tab(tab_name);
+
+        var state = that.get_path_state(tab.name);
+
+        if (tab.entity) {
+
+            if (tab.facet) {
+                state[tab.entity.name + '-facet'] = tab.facet;
+            }
+
+            if (pkey) {
+                state[tab.entity.name + '-pkey'] = pkey;
+            }
+        }
+
+        return that.push_state(state);
+    };
+
     that.show_page = function(entity_name, facet_name, pkey) {
         var state = that.get_path_state(entity_name);
 
@@ -243,6 +263,22 @@ IPA.navigation = function(spec) {
         return that.push_state(state);
     };
 
+    that.get_tab_facet = function(tab_name) {
+
+        var facet = null;
+        var tab = that.get_tab(tab_name);
+
+        if (tab.entity) {
+            if (tab.facet) {
+                facet = tab.entity.get_facet(tab.facet);
+            } else {
+                facet = tab.entity.get_facet(tab.entity.redirect_facet);
+            }
+        }
+
+        return facet;
+    };
+
 
     that.create = function() {
 
@@ -279,7 +315,7 @@ IPA.navigation = function(spec) {
                 }
 
                 // selection is triggered by mouse click, update the URL state
-                return that.show_page(name);
+                return that.show_tab(name);
             }
         });
     };
@@ -389,8 +425,8 @@ IPA.navigation = function(spec) {
                                      that.content);
             if (!entity_container.length) {
                 tab.content = $('<div/>', {
-                    name: tab.name,
-                    title: tab.label,
+                    name: tab.entity.name,
+                    title: tab.entity.label,
                     'class': 'entity'
                 }).appendTo(that.content);
                 tab.entity.create(tab.content);
-- 
1.7.7.5

From 618e5817eb81f988c4163a5ff0d81bd5a103f70a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Voborn=C3=ADk?= <pvobo...@redhat.com>
Date: Wed, 25 Jan 2012 13:06:15 +0100
Subject: [PATCH] Automember UI

New UI for automember.

https://fedorahosted.org/freeipa/ticket/2195
---
 install/ui/Makefile.am                             |    1 +
 install/ui/automember.js                           |  200 ++++++++++++++++++++
 install/ui/facet.js                                |   13 +-
 install/ui/index.html                              |    1 +
 install/ui/jsl.conf                                |    1 +
 install/ui/test/data/automembergroup_add.json      |   21 ++
 .../ui/test/data/automembergroup_find_pkeys.json   |   24 +++
 .../ui/test/data/automembergroup_get_records.json  |   27 +++
 install/ui/test/data/automembergroup_show.json     |   21 ++
 install/ui/test/data/automemberhostgroup_add.json  |   21 ++
 .../test/data/automemberhostgroup_find_pkeys.json  |   24 +++
 .../test/data/automemberhostgroup_get_records.json |   27 +++
 install/ui/test/data/automemberhostgroup_show.json |   21 ++
 install/ui/test/data/ipa_init.json                 |    1 +
 install/ui/webui.js                                |    7 +-
 15 files changed, 407 insertions(+), 3 deletions(-)
 create mode 100644 install/ui/automember.js
 create mode 100644 install/ui/test/data/automembergroup_add.json
 create mode 100644 install/ui/test/data/automembergroup_find_pkeys.json
 create mode 100644 install/ui/test/data/automembergroup_get_records.json
 create mode 100644 install/ui/test/data/automembergroup_show.json
 create mode 100644 install/ui/test/data/automemberhostgroup_add.json
 create mode 100644 install/ui/test/data/automemberhostgroup_find_pkeys.json
 create mode 100644 install/ui/test/data/automemberhostgroup_get_records.json
 create mode 100644 install/ui/test/data/automemberhostgroup_show.json

diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am
index 822a6282f3a447e24282e4112df2e63457890fa7..d87a0944ca47e1885a9a2781e6ed03e30c662fe6 100644
--- a/install/ui/Makefile.am
+++ b/install/ui/Makefile.am
@@ -11,6 +11,7 @@ app_DATA =				\
 	aci.js				\
 	add.js				\
 	association.js			\
+	automember.js			\
 	automount.js			\
 	browser.js			\
 	certificate.js 			\
diff --git a/install/ui/automember.js b/install/ui/automember.js
new file mode 100644
index 0000000000000000000000000000000000000000..03ea447b6df36638f343642b4d6e58bf1f5a9c86
--- /dev/null
+++ b/install/ui/automember.js
@@ -0,0 +1,200 @@
+/*jsl:import ipa.js */
+
+/*  Authors:
+ *    Petr Vobornik <pvobo...@redhat.com>
+ *
+ * Copyright (C) 2012 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
+
+IPA.automember = {};
+
+IPA.automember.entity = function(spec) {
+
+     //HACK: copy cn param to entity metadata and set it as pkey
+    var pkey_attr = IPA.metadata.commands.automember_mod.takes_args[0];
+    pkey_attr.primary_key = true;
+    IPA.metadata.objects.automember.takes_params.push(pkey_attr);
+    IPA.metadata.objects.automember.primary_key = pkey_attr.name;
+
+    var that = IPA.entity(spec);
+
+    that.init = function() {
+
+        that.entity_init();
+
+        that.builder.search_facet({
+            factory: IPA.automember.rule_search_facet,
+            name: 'searchgroup',
+            group_type: 'group',
+            label: 'User group rules',
+            details_facet: 'usergrouprule',
+            columns: [
+                'cn',
+                'description'
+            ]
+        }).
+        search_facet({
+            factory: IPA.automember.rule_search_facet,
+            name: 'searchhostgroup',
+            group_type: 'hostgroup',
+            label: 'Host group rules',
+            details_facet: 'hostgrouprule',
+            columns: [
+                'cn',
+                'description'
+            ]
+        }).
+        details_facet({
+            factory: IPA.automember.rule_details_facet,
+            name: 'usergrouprule',
+            group_type: 'group',
+            label: 'User group rule',
+            disable_facet_tabs: true,
+            redirect_info: { tab: 'amgroup' },
+            sections: [
+                {
+                    name: 'general',
+                    label: IPA.messages.details.general,
+                    fields: ['cn', 'description']
+                }
+            ]
+        }).
+        details_facet({
+            factory: IPA.automember.rule_details_facet,
+            name: 'hostgrouprule',
+            group_type: 'hostgroup',
+            label: 'Host group rule',
+            disable_facet_tabs: true,
+            redirect_info: { tab: 'amhostgroup' },
+            sections: [
+                {
+                    name: 'general',
+                    label: IPA.messages.details.general,
+                    fields: ['cn', 'description']
+                }
+            ]
+        }).
+        adder_dialog({
+            factory: IPA.automember.rule_adder_dialog,
+            fields: [
+                'cn'
+            ]
+        });
+    };
+
+    return that;
+};
+
+
+IPA.automember.rule_search_facet = function(spec) {
+
+    spec = spec || {};
+
+    var that = IPA.search_facet(spec);
+
+    that.group_type = spec.group_type;
+
+    that.get_records_command_name = function() {
+        return that.managed_entity.name + that.group_type+'_get_records';
+    };
+
+    that.get_search_command_name = function() {
+        var name = that.managed_entity.name + that.group_type + '_find';
+        if (that.pagination && !that.search_all_entries) {
+            name += '_pkeys';
+        }
+        return name;
+    };
+
+    that.create_get_records_command = function(pkeys, on_success, on_error) {
+
+        var batch = that.table_facet_create_get_records_command(pkeys, on_success, on_error);
+
+        for (var i=0; i<batch.commands.length; i++) {
+            var command = batch.commands[i];
+            command.set_option('type', that.group_type);
+        }
+
+        return batch;
+    };
+
+    that.create_refresh_command = function() {
+
+        var command = that.search_facet_create_refresh_command();
+
+        command.set_option('type', that.group_type);
+
+        return command;
+    };
+
+    return that;
+};
+
+IPA.automember.rule_details_facet = function(spec) {
+
+    spec = spec || {};
+
+     var that = IPA.details_facet(spec);
+
+    that.group_type = spec.group_type;
+
+    that.get_refresh_command_name = function() {
+        return that.entity.name+that.group_type+'_show';
+    };
+
+    that.create_refresh_command = function() {
+
+        var command = that.details_facet_create_refresh_command();
+        command.set_option('type', that.group_type);
+
+        return command;
+    };
+
+    that.create_update_command = function() {
+
+        var command = that.details_facet_create_update_command();
+        command.set_option('type', that.group_type);
+
+        return command;
+    };
+
+    return that;
+};
+
+IPA.automember.rule_adder_dialog = function(spec) {
+
+    spec = spec || {};
+
+    var that = IPA.entity_adder_dialog(spec);
+
+
+    that.create_add_command = function(record) {
+
+        var facet = IPA.current_entity.get_facet();
+        var command = that.entity_adder_dialog_create_add_command(record);
+        command.name = that.entity.name+facet.group_type+'_show';
+        command.set_option('type', facet.group_type);
+
+        return command;
+    };
+
+    return that;
+};
+
+IPA.register('automember', IPA.automember.entity);
\ No newline at end of file
diff --git a/install/ui/facet.js b/install/ui/facet.js
index ecb76760368ef9182480bf7075e7fe78bcc770b6..430ad160ab856a49e1e1ddb3fa2c07c3ba241624 100644
--- a/install/ui/facet.js
+++ b/install/ui/facet.js
@@ -660,9 +660,9 @@ IPA.table_facet = function(spec) {
         return that.managed_entity.name+'_get_records';
     };
 
-    that.get_records = function(pkeys, on_success, on_error) {
+    that.create_get_records_command = function(pkeys, on_success, on_error) {
 
-        var batch = IPA.batch_command({
+         var batch = IPA.batch_command({
             name: that.get_records_command_name(),
             on_success: on_success,
             on_error: on_error
@@ -681,6 +681,13 @@ IPA.table_facet = function(spec) {
             batch.add_command(command);
         }
 
+        return batch;
+    };
+
+    that.get_records = function(pkeys, on_success, on_error) {
+
+        var batch = that.create_get_records_command(pkeys, on_success, on_error);
+
         batch.execute();
     };
 
@@ -766,6 +773,8 @@ IPA.table_facet = function(spec) {
 
     init();
 
+    that.table_facet_create_get_records_command = that.create_get_records_command;
+
     return that;
 };
 
diff --git a/install/ui/index.html b/install/ui/index.html
index 64c87d8916ab5c7969f92373804823fcb331fa34..db314331ab515b41ea17a1f7550c7444941bedd4 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -25,6 +25,7 @@
     <script type="text/javascript" src="navigation.js"></script>
     <script type="text/javascript" src="rule.js"></script>
 
+    <script type="text/javascript" src="automember.js"></script>
     <script type="text/javascript" src="automount.js"></script>
     <script type="text/javascript" src="dns.js"></script>
     <script type="text/javascript" src="certificate.js"></script>
diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf
index 7373e987daa676a05adf2ac4cc0420f2b1c40367..508897af11af1ce19658180a3c5cf2edb9b9da90 100644
--- a/install/ui/jsl.conf
+++ b/install/ui/jsl.conf
@@ -155,4 +155,5 @@
 +process aci.js
 +process dns.js
 +process automount.js
++process automember.js
 +process webui.js
diff --git a/install/ui/test/data/automembergroup_add.json b/install/ui/test/data/automembergroup_add.json
new file mode 100644
index 0000000000000000000000000000000000000000..7b896d2a5d5a82cc1c55d4cc8416116d6b325861
--- /dev/null
+++ b/install/ui/test/data/automembergroup_add.json
@@ -0,0 +1,21 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "result": {
+            "automembertargetgroup": [
+                "cn=foogroup,cn=groups,cn=accounts,dc=dev,dc=example,dc=com"
+            ],
+            "cn": [
+                "foogroup"
+            ],
+            "dn": "cn=foogroup,cn=group,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+            "objectclass": [
+                "top",
+                "automemberregexrule"
+            ]
+        },
+        "summary": "Added automember rule \"foogroup\"",
+        "value": "foogroup"
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automembergroup_find_pkeys.json b/install/ui/test/data/automembergroup_find_pkeys.json
new file mode 100644
index 0000000000000000000000000000000000000000..c8918c6cc091ac42d9010b63c7a75d65725b20dc
--- /dev/null
+++ b/install/ui/test/data/automembergroup_find_pkeys.json
@@ -0,0 +1,24 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "result": [
+            {
+                "automembertargetgroup": [
+                    "cn=foogroup,cn=groups,cn=accounts,dc=dev,dc=example,dc=com"
+                ],
+                "cn": [
+                    "foogroup"
+                ],
+                "dn": "cn=foogroup,cn=group,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+                "objectclass": [
+                    "top",
+                    "automemberregexrule"
+                ]
+            }
+        ],
+        "summary": "1 rules matched",
+        "truncated": false
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automembergroup_get_records.json b/install/ui/test/data/automembergroup_get_records.json
new file mode 100644
index 0000000000000000000000000000000000000000..82bcc71035e568ac00b66a66e9a503855193c9e5
--- /dev/null
+++ b/install/ui/test/data/automembergroup_get_records.json
@@ -0,0 +1,27 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "results": [
+            {
+                "error": null,
+                "result": {
+                    "automembertargetgroup": [
+                        "cn=foogroup,cn=groups,cn=accounts,dc=dev,dc=example,dc=com"
+                    ],
+                    "cn": [
+                        "foogroup"
+                    ],
+                    "dn": "cn=foogroup,cn=group,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+                    "objectclass": [
+                        "top",
+                        "automemberregexrule"
+                    ]
+                },
+                "summary": null,
+                "value": "foogroup"
+            }
+        ]
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automembergroup_show.json b/install/ui/test/data/automembergroup_show.json
new file mode 100644
index 0000000000000000000000000000000000000000..0b807baabf7b4dcedb5a3e86e86d65cab2c1c918
--- /dev/null
+++ b/install/ui/test/data/automembergroup_show.json
@@ -0,0 +1,21 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "result": {
+            "automembertargetgroup": [
+                "cn=foogroup,cn=groups,cn=accounts,dc=dev,dc=example,dc=com"
+            ],
+            "cn": [
+                "foogroup"
+            ],
+            "dn": "cn=foogroup,cn=group,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+            "objectclass": [
+                "top",
+                "automemberregexrule"
+            ]
+        },
+        "summary": null,
+        "value": "foogroup"
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automemberhostgroup_add.json b/install/ui/test/data/automemberhostgroup_add.json
new file mode 100644
index 0000000000000000000000000000000000000000..e58d21883d70bd0ca153af45270ff843d313b4f2
--- /dev/null
+++ b/install/ui/test/data/automemberhostgroup_add.json
@@ -0,0 +1,21 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "result": {
+            "automembertargetgroup": [
+                "cn=foohostgroup,cn=hostgroups,cn=accounts,dc=dev,dc=example,dc=com"
+            ],
+            "cn": [
+                "foohostgroup"
+            ],
+            "dn": "cn=foohostgroup,cn=hostgroup,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+            "objectclass": [
+                "top",
+                "automemberregexrule"
+            ]
+        },
+        "summary": "Added automember rule \"foohostgroup\"",
+        "value": "foohostgroup"
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automemberhostgroup_find_pkeys.json b/install/ui/test/data/automemberhostgroup_find_pkeys.json
new file mode 100644
index 0000000000000000000000000000000000000000..909683465b6892ea08a1f397e2f153f799567298
--- /dev/null
+++ b/install/ui/test/data/automemberhostgroup_find_pkeys.json
@@ -0,0 +1,24 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "result": [
+            {
+                "automembertargetgroup": [
+                    "cn=foohostgroup,cn=hostgroups,cn=accounts,dc=dev,dc=example,dc=com"
+                ],
+                "cn": [
+                    "foohostgroup"
+                ],
+                "dn": "cn=foohostgroup,cn=hostgroup,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+                "objectclass": [
+                    "top",
+                    "automemberregexrule"
+                ]
+            }
+        ],
+        "summary": "1 rules matched",
+        "truncated": false
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automemberhostgroup_get_records.json b/install/ui/test/data/automemberhostgroup_get_records.json
new file mode 100644
index 0000000000000000000000000000000000000000..6ae23e3269a318feacf0e67432609d99b643cb92
--- /dev/null
+++ b/install/ui/test/data/automemberhostgroup_get_records.json
@@ -0,0 +1,27 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "results": [
+            {
+                "error": null,
+                "result": {
+                    "automembertargetgroup": [
+                        "cn=foohostgroup,cn=hostgroups,cn=accounts,dc=dev,dc=example,dc=com"
+                    ],
+                    "cn": [
+                        "foohostgroup"
+                    ],
+                    "dn": "cn=foohostgroup,cn=hostgroup,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+                    "objectclass": [
+                        "top",
+                        "automemberregexrule"
+                    ]
+                },
+                "summary": null,
+                "value": "foohostgroup"
+            }
+        ]
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/automemberhostgroup_show.json b/install/ui/test/data/automemberhostgroup_show.json
new file mode 100644
index 0000000000000000000000000000000000000000..8ff67aa8cf1ad2feda519da85a80d2f3405f8298
--- /dev/null
+++ b/install/ui/test/data/automemberhostgroup_show.json
@@ -0,0 +1,21 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "result": {
+            "automembertargetgroup": [
+                "cn=foohostgroup,cn=hostgroups,cn=accounts,dc=dev,dc=example,dc=com"
+            ],
+            "cn": [
+                "foohostgroup"
+            ],
+            "dn": "cn=foohostgroup,cn=hostgroup,cn=automember,cn=etc,dc=dev,dc=example,dc=com",
+            "objectclass": [
+                "top",
+                "automemberregexrule"
+            ]
+        },
+        "summary": null,
+        "value": "foohostgroup"
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index e3e48949033de5bb7213db5482b0cff2e74ac48c..c5995026001709be4d1d262e90b0193d4bfb12a0 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -366,6 +366,7 @@
                     },
                     "tabs": {
                         "audit": "Audit",
+                        "automember": "Automember",
                         "automount": "Automount",
                         "dns": "DNS",
                         "hbac": "Host Based Access Control",
diff --git a/install/ui/webui.js b/install/ui/webui.js
index 596097344979dfa7f3561ac25f41b7bd520dae8d..def23f841da5db10c4ee05f79374776a602fc1d5 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -68,7 +68,12 @@ IPA.admin_navigation = function(spec) {
                 {entity: 'automountkey', hidden: true}]},
             {entity: 'pwpolicy'},
             {entity: 'krbtpolicy'},
-            {entity: 'selinuxusermap'}
+            {entity: 'selinuxusermap'},
+            {name: 'automember', label: 'Automember', //FIXME: IPA.messages.tabs.automember
+             children: [
+                { name: 'amgroup', entity: 'automember', facet: 'searchgroup', label: 'User group rules'},
+                { name: 'amhostgroup', entity: 'automember', facet: 'searchhostgroup', label: 'Host group rules'}
+            ]}
         ]},
         {name: 'ipaserver', label: IPA.messages.tabs.ipaserver, children: [
             {name: 'rolebased', label: IPA.messages.tabs.role, children: [
-- 
1.7.7.5

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

Reply via email to