e3ffab
From 8918cc58cb4cd24a4332c9935be75add89fd3c8b Mon Sep 17 00:00:00 2001
e3ffab
From: Petr Vobornik <pvoborni@redhat.com>
e3ffab
Date: Tue, 4 Nov 2014 13:38:12 +0100
e3ffab
Subject: [PATCH] webui: use domain name instead of domain SID in idrange adder
e3ffab
 dialog
e3ffab
e3ffab
It's more user friendly. Almost nobody remembers SIDs.
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4661
e3ffab
e3ffab
Reviewed-By: Tomas Babej <tbabej@redhat.com>
e3ffab
---
e3ffab
 install/ui/src/freeipa/idrange.js | 16 +++++++---------
e3ffab
 ipatests/test_webui/task_range.py | 20 ++++++++++----------
e3ffab
 ipatests/test_webui/test_range.py |  4 ++--
e3ffab
 3 files changed, 19 insertions(+), 21 deletions(-)
e3ffab
e3ffab
diff --git a/install/ui/src/freeipa/idrange.js b/install/ui/src/freeipa/idrange.js
e3ffab
index 4e5dbfa00dcf80495d8a96f7fc961b9c6676691f..8af1598af335db2429512910d286bc3bada7b325 100644
e3ffab
--- a/install/ui/src/freeipa/idrange.js
e3ffab
+++ b/install/ui/src/freeipa/idrange.js
e3ffab
@@ -138,9 +138,7 @@ return {
e3ffab
                 title: '@mo-param:idrange:ipasecondarybaserid:label'
e3ffab
             },
e3ffab
             {
e3ffab
-                name: 'ipanttrusteddomainsid',
e3ffab
-                label: '@i18n:objects.idrange.ipanttrusteddomainsid',
e3ffab
-                title: '@mo-param:idrange:ipanttrusteddomainsid:label',
e3ffab
+                name: 'ipanttrusteddomainname',
e3ffab
                 enabled: false
e3ffab
             }
e3ffab
         ],
e3ffab
@@ -153,14 +151,14 @@ return {
e3ffab
 IPA.idrange_adder_policy = function(spec) {
e3ffab
     /*
e3ffab
     The logic for enabling/requiring ipabaserid, ipasecondarybaserid and
e3ffab
-    ipanttrusteddomainsid is as follows:
e3ffab
+    ipanttrusteddomainname is as follows:
e3ffab
         1) for AD ranges (range type is ipa-ad-trust or ipa-ad-trust-posix):
e3ffab
-           * ipanttrusteddomainsid is required
e3ffab
+           * ipanttrusteddomainname is required
e3ffab
            * ipabaserid is required for ipa-ad-trust but disabled for
e3ffab
              ipa-ad-trust-posix
e3ffab
            * ipasecondarybaserid is disabled
e3ffab
         2) for local ranges
e3ffab
-           *  ipanttrusteddomainsid is disabled
e3ffab
+           *  ipanttrusteddomainname is disabled
e3ffab
            A) if server has AD trust support:
e3ffab
               * both ipabaserid and ipasecondarybaserid are required
e3ffab
            B) if server does not have AD trust support:
e3ffab
@@ -207,7 +205,7 @@ IPA.idrange_adder_policy = function(spec) {
e3ffab
         var type_f = that.container.fields.get_field('iparangetype');
e3ffab
         var baserid_f = that.container.fields.get_field('ipabaserid');
e3ffab
         var secondarybaserid_f = that.container.fields.get_field('ipasecondarybaserid');
e3ffab
-        var trusteddomainsid_f = that.container.fields.get_field('ipanttrusteddomainsid');
e3ffab
+        var trusteddomainname_f = that.container.fields.get_field('ipanttrusteddomainname');
e3ffab
 
e3ffab
         var type_v = type_f.get_value()[0];
e3ffab
         var baserid_v = baserid_f.get_value()[0] || '';
e3ffab
@@ -221,10 +219,10 @@ IPA.idrange_adder_policy = function(spec) {
e3ffab
             } else {
e3ffab
                 disable(baserid_f);
e3ffab
             }
e3ffab
-            require(trusteddomainsid_f);
e3ffab
+            require(trusteddomainname_f);
e3ffab
             disable(secondarybaserid_f);
e3ffab
         } else {
e3ffab
-            disable(trusteddomainsid_f);
e3ffab
+            disable(trusteddomainname_f);
e3ffab
 
e3ffab
             if (IPA.trust_enabled) {
e3ffab
                 require(baserid_f);
e3ffab
diff --git a/ipatests/test_webui/task_range.py b/ipatests/test_webui/task_range.py
e3ffab
index d46d345f03a2b50730e3107ef6f7c2222da4465c..b71285d1e6056b11e3e74703a568be27973de3bc 100644
e3ffab
--- a/ipatests/test_webui/task_range.py
e3ffab
+++ b/ipatests/test_webui/task_range.py
e3ffab
@@ -59,13 +59,13 @@ class range_tasks(UI_driver):
e3ffab
         self.max_id = max_id
e3ffab
         self.max_rid = max_rid
e3ffab
 
e3ffab
-    def get_sid(self):
e3ffab
+    def get_domain(self):
e3ffab
         result = self.execute_api_from_ui('trust_find', [], {})
e3ffab
         trusts = result['result']['result']
e3ffab
-        sid = None
e3ffab
+        domain = None
e3ffab
         if trusts:
e3ffab
-            sid = trusts[0]['ipanttrusteddomainsid']
e3ffab
-        return sid
e3ffab
+            domain = trusts[0]['cn']
e3ffab
+        return domain
e3ffab
 
e3ffab
     def get_data(self, pkey, size=50, add_data=None):
e3ffab
 
e3ffab
@@ -81,7 +81,7 @@ class range_tasks(UI_driver):
e3ffab
         }
e3ffab
         return data
e3ffab
 
e3ffab
-    def get_add_data(self, pkey, range_type='ipa-local', size=50, shift=100, sid=None):
e3ffab
+    def get_add_data(self, pkey, range_type='ipa-local', size=50, shift=100, domain=None):
e3ffab
 
e3ffab
         base_id = self.max_id + shift
e3ffab
         self.max_id = base_id + size
e3ffab
@@ -98,19 +98,19 @@ class range_tasks(UI_driver):
e3ffab
             ('callback', self.check_range_type_mod, range_type)
e3ffab
         ]
e3ffab
 
e3ffab
-        if not sid:
e3ffab
+        if not domain:
e3ffab
             base_rid = self.max_rid + shift
e3ffab
             self.max_rid = base_rid + size
e3ffab
             add.append(('textbox', 'ipasecondarybaserid', str(base_rid)))
e3ffab
-        if sid:
e3ffab
-            add.append(('textbox', 'ipanttrusteddomainsid', sid))
e3ffab
+        if domain:
e3ffab
+            add.append(('textbox', 'ipanttrusteddomainname', domain))
e3ffab
 
e3ffab
         return add
e3ffab
 
e3ffab
     def check_range_type_mod(self, range_type):
e3ffab
         if range_type == 'ipa-local':
e3ffab
-            self.assert_disabled("[name=ipanttrusteddomainsid]")
e3ffab
+            self.assert_disabled("[name=ipanttrusteddomainname]")
e3ffab
             self.assert_disabled("[name=ipasecondarybaserid]", negative=True)
e3ffab
         elif range_type == 'ipa-ad-trust':
e3ffab
-            self.assert_disabled("[name=ipanttrusteddomainsid]", negative=True)
e3ffab
+            self.assert_disabled("[name=ipanttrusteddomainname]", negative=True)
e3ffab
             self.assert_disabled("[name=ipasecondarybaserid]")
e3ffab
diff --git a/ipatests/test_webui/test_range.py b/ipatests/test_webui/test_range.py
e3ffab
index 5c2e33b90833d5e03014e72fad302e58c986ca25..e1c46e50a85171bafabe80bd772ed9ac983a6ca4 100644
e3ffab
--- a/ipatests/test_webui/test_range.py
e3ffab
+++ b/ipatests/test_webui/test_range.py
e3ffab
@@ -74,11 +74,11 @@ class test_range(range_tasks):
e3ffab
 
e3ffab
             self.add_record(trust_mod.ENTITY, trust_data)
e3ffab
 
e3ffab
-            sid = self.get_sid()
e3ffab
+            domain = self.get_domain()
e3ffab
 
e3ffab
             self.navigate_to_entity(ENTITY)
e3ffab
 
e3ffab
-            add = self.get_add_data(pkey_ad, range_type='ipa-ad-trust', sid=sid)
e3ffab
+            add = self.get_add_data(pkey_ad, range_type='ipa-ad-trust', domain=domain)
e3ffab
             data = self.get_data(pkey_ad, add_data=add)
e3ffab
             self.add_record(ENTITY, data, navigate=False)
e3ffab
             self.assert_record_value('Active Directory domain range', pkey_ad, column)
e3ffab
-- 
e3ffab
2.1.0
e3ffab