pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
9991ea
From 8dcaa8f17b94fd7056340622e49d8ab505694603 Mon Sep 17 00:00:00 2001
9991ea
From: Petr Vobornik <pvoborni@redhat.com>
9991ea
Date: Wed, 15 Jan 2014 18:01:02 +0100
9991ea
Subject: [PATCH] Trust domains Web UI
9991ea
9991ea
Add Web UI counterpart of following CLI commands:
9991ea
9991ea
* trust-fetch-domains Refresh list of the domains associated with the trust
9991ea
* trustdomain-del Remove infromation about the domain associated with the trust.
9991ea
* trustdomain-disable Disable use of IPA resources by the domain of the trust
9991ea
* trustdomain-enable Allow use of IPA resources by the domain of the trust
9991ea
* trustdomain-find Search domains of the trust
9991ea
9991ea
https://fedorahosted.org/freeipa/ticket/4119
9991ea
---
9991ea
 install/ui/src/freeipa/search.js   | 11 +++---
9991ea
 install/ui/src/freeipa/trust.js    | 68 ++++++++++++++++++++++++++++++++++++++
9991ea
 install/ui/test/data/ipa_init.json |  1 +
9991ea
 ipalib/plugins/internal.py         |  1 +
9991ea
 4 files changed, 77 insertions(+), 4 deletions(-)
9991ea
9991ea
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
9991ea
index c2e678a35e7d7d5179c1b766eea88599710593c3..3f7fdf9b1e6716c73e0657dc678abe332f6fc8c0 100644
9991ea
--- a/install/ui/src/freeipa/search.js
9991ea
+++ b/install/ui/src/freeipa/search.js
9991ea
@@ -470,20 +470,23 @@ IPA.batch_items_action = function(spec) {
9991ea
     that.execute_action = function(facet, on_success, on_error) {
9991ea
 
9991ea
         var entity = facet.managed_entity;
9991ea
-        var pkeys = facet.get_selected_values();
9991ea
+        var selected_keys = facet.get_selected_values();
9991ea
+        var pkeys = facet.get_pkeys();
9991ea
+        if (!pkeys[0]) pkeys = []; // correction for search facet
9991ea
 
9991ea
         that.batch = IPA.batch_command({
9991ea
             name: entity.name + '_batch_'+ that.method,
9991ea
             on_success: that.get_on_success(facet, on_success)
9991ea
         });
9991ea
 
9991ea
-        for (var i=0; i
9991ea
-            var pkey = pkeys[i];
9991ea
+        for (var i=0; i
9991ea
+            var item_keys = pkeys.splice(0);
9991ea
+            item_keys.push(selected_keys[i]);
9991ea
 
9991ea
             var command = IPA.command({
9991ea
                 entity: entity.name,
9991ea
                 method: that.method,
9991ea
-                args: [pkey]
9991ea
+                args: item_keys
9991ea
             });
9991ea
 
9991ea
             that.batch.add_command(command);
9991ea
diff --git a/install/ui/src/freeipa/trust.js b/install/ui/src/freeipa/trust.js
9991ea
index 2653d3e67c2c5591f000e32c43a3a5878eef28fd..51f2000b47fd7943cb9a200c9bec7ebd3459178a 100644
9991ea
--- a/install/ui/src/freeipa/trust.js
9991ea
+++ b/install/ui/src/freeipa/trust.js
9991ea
@@ -48,6 +48,7 @@ return {
9991ea
             dest_facet: 'search'
9991ea
         }
9991ea
     ],
9991ea
+    facet_groups: [ 'settings', 'trustdomain' ],
9991ea
     facets: [
9991ea
         {
9991ea
             $type: 'search',
9991ea
@@ -56,6 +57,63 @@ return {
9991ea
             ]
9991ea
         },
9991ea
         {
9991ea
+            $type: 'nested_search',
9991ea
+            $pre_ops: [
9991ea
+                // trustdomain-add is hidden, remove add button
9991ea
+                { $del: [[ 'control_buttons', [{ name: 'add'}] ]] }
9991ea
+            ],
9991ea
+            nested_entity: 'trustdomain',
9991ea
+            facet_group: 'trustdomain',
9991ea
+            name: 'domains',
9991ea
+            label: '@mo:trustdomain.label',
9991ea
+            tab_label: '@mo:trustdomain.label',
9991ea
+            search_all_entries: true,
9991ea
+            actions: [
9991ea
+                {
9991ea
+                    $type: 'batch_disable'
9991ea
+                },
9991ea
+                {
9991ea
+                    $type: 'batch_enable'
9991ea
+                },
9991ea
+                {
9991ea
+                    $type: 'object',
9991ea
+                    name: 'fetch',
9991ea
+                    label: '@i18n:objects.trust.fetch_domains',
9991ea
+                    method: 'fetch_domains'
9991ea
+                }
9991ea
+            ],
9991ea
+            control_buttons: [
9991ea
+                {
9991ea
+                    name: 'disable',
9991ea
+                    label: '@i18n:buttons.disable',
9991ea
+                    icon: 'fa-minus'
9991ea
+                },
9991ea
+                {
9991ea
+                    name: 'enable',
9991ea
+                    label: '@i18n:buttons.enable',
9991ea
+                    icon: 'fa-check'
9991ea
+                },
9991ea
+                {
9991ea
+                    name: 'fetch',
9991ea
+                    label: '@i18n:objects.trust.fetch_domains',
9991ea
+                    icon: 'fa-download'
9991ea
+                }
9991ea
+            ],
9991ea
+            columns: [
9991ea
+                {
9991ea
+                    name: 'cn',
9991ea
+                    link: false
9991ea
+                },
9991ea
+                {
9991ea
+                    name: 'domain_enabled',
9991ea
+                    label: '@i18n:status.label',
9991ea
+                    formatter: 'boolean_status'
9991ea
+                },
9991ea
+                'ipantflatname',
9991ea
+                'ipanttrusteddomainsid'
9991ea
+            ]
9991ea
+        },
9991ea
+        {
9991ea
             $type: 'details',
9991ea
             sections: [
9991ea
                 {
9991ea
@@ -261,6 +319,13 @@ IPA.trust.adder_dialog = function(spec) {
9991ea
     return that;
9991ea
 };
9991ea
 
9991ea
+
9991ea
+var make_trustdomain_spec = function() {
9991ea
+return {
9991ea
+    name: 'trustdomain',
9991ea
+    containing_entity: 'trust'
9991ea
+};};
9991ea
+
9991ea
 var make_trustconfig_spec = function() {
9991ea
 return {
9991ea
     name: 'trustconfig',
9991ea
@@ -349,14 +414,17 @@ exp.remove_menu_item = function() {
9991ea
 };
9991ea
 
9991ea
 exp.trust_spec = make_trust_spec();
9991ea
+exp.trustdomain_spec = make_trustdomain_spec();
9991ea
 exp.trustconfig_spec = make_trustconfig_spec();
9991ea
 
9991ea
+
9991ea
 IPA.trust.register = function() {
9991ea
     var e = reg.entity;
9991ea
     var w = reg.widget;
9991ea
     var f = reg.field;
9991ea
 
9991ea
     e.register({type: 'trust', spec: exp.trust_spec});
9991ea
+    e.register({type: 'trustdomain', spec: exp.trustdomain_spec});
9991ea
     e.register({type: 'trustconfig', spec: exp.trustconfig_spec});
9991ea
 
9991ea
     w.register('trust_fallbackgroup_select', IPA.trust.fallbackgroup_select_widget);
9991ea
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
9991ea
index 8e0b2a33cc45d2a68878b7f3ab49b1491ae7c3f5..80a1c08ed3745bdce44676c6f2716e207f653e8d 100644
9991ea
--- a/install/ui/test/data/ipa_init.json
9991ea
+++ b/install/ui/test/data/ipa_init.json
9991ea
@@ -464,6 +464,7 @@
9991ea
                             "details": "Trust Settings",
9991ea
                             "domain": "Domain",
9991ea
                             "establish_using": "Establish using",
9991ea
+                            "fetch_domains": "Fetch domains",
9991ea
                             "ipantflatname": "Domain NetBIOS name",
9991ea
                             "ipanttrusteddomainsid": "Domain Security Identifier",
9991ea
                             "preshared_password": "Pre-shared password",
9991ea
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
9991ea
index 83b505dae1c6349097f7ad5ed20ab25b5a262aa8..dbd40f91ef2b84beb1bb521dcbcdb059cd3b3c7e 100644
9991ea
--- a/ipalib/plugins/internal.py
9991ea
+++ b/ipalib/plugins/internal.py
9991ea
@@ -600,6 +600,7 @@ class i18n_messages(Command):
9991ea
                 "details": _("Trust Settings"),
9991ea
                 "domain": _("Domain"),
9991ea
                 "establish_using": _("Establish using"),
9991ea
+                "fetch_domains": _("Fetch domains"),
9991ea
                 "ipantflatname": _("Domain NetBIOS name"),
9991ea
                 "ipanttrusteddomainsid": _("Domain Security Identifier"),
9991ea
                 "preshared_password": _("Pre-shared password"),
9991ea
-- 
9991ea
1.8.4.2
9991ea