Blob Blame History Raw
From 8918cc58cb4cd24a4332c9935be75add89fd3c8b Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvoborni@redhat.com>
Date: Tue, 4 Nov 2014 13:38:12 +0100
Subject: [PATCH] webui: use domain name instead of domain SID in idrange adder
 dialog

It's more user friendly. Almost nobody remembers SIDs.

https://fedorahosted.org/freeipa/ticket/4661

Reviewed-By: Tomas Babej <tbabej@redhat.com>
---
 install/ui/src/freeipa/idrange.js | 16 +++++++---------
 ipatests/test_webui/task_range.py | 20 ++++++++++----------
 ipatests/test_webui/test_range.py |  4 ++--
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/install/ui/src/freeipa/idrange.js b/install/ui/src/freeipa/idrange.js
index 4e5dbfa00dcf80495d8a96f7fc961b9c6676691f..8af1598af335db2429512910d286bc3bada7b325 100644
--- a/install/ui/src/freeipa/idrange.js
+++ b/install/ui/src/freeipa/idrange.js
@@ -138,9 +138,7 @@ return {
                 title: '@mo-param:idrange:ipasecondarybaserid:label'
             },
             {
-                name: 'ipanttrusteddomainsid',
-                label: '@i18n:objects.idrange.ipanttrusteddomainsid',
-                title: '@mo-param:idrange:ipanttrusteddomainsid:label',
+                name: 'ipanttrusteddomainname',
                 enabled: false
             }
         ],
@@ -153,14 +151,14 @@ return {
 IPA.idrange_adder_policy = function(spec) {
     /*
     The logic for enabling/requiring ipabaserid, ipasecondarybaserid and
-    ipanttrusteddomainsid is as follows:
+    ipanttrusteddomainname is as follows:
         1) for AD ranges (range type is ipa-ad-trust or ipa-ad-trust-posix):
-           * ipanttrusteddomainsid is required
+           * ipanttrusteddomainname is required
            * ipabaserid is required for ipa-ad-trust but disabled for
              ipa-ad-trust-posix
            * ipasecondarybaserid is disabled
         2) for local ranges
-           *  ipanttrusteddomainsid is disabled
+           *  ipanttrusteddomainname is disabled
            A) if server has AD trust support:
               * both ipabaserid and ipasecondarybaserid are required
            B) if server does not have AD trust support:
@@ -207,7 +205,7 @@ IPA.idrange_adder_policy = function(spec) {
         var type_f = that.container.fields.get_field('iparangetype');
         var baserid_f = that.container.fields.get_field('ipabaserid');
         var secondarybaserid_f = that.container.fields.get_field('ipasecondarybaserid');
-        var trusteddomainsid_f = that.container.fields.get_field('ipanttrusteddomainsid');
+        var trusteddomainname_f = that.container.fields.get_field('ipanttrusteddomainname');
 
         var type_v = type_f.get_value()[0];
         var baserid_v = baserid_f.get_value()[0] || '';
@@ -221,10 +219,10 @@ IPA.idrange_adder_policy = function(spec) {
             } else {
                 disable(baserid_f);
             }
-            require(trusteddomainsid_f);
+            require(trusteddomainname_f);
             disable(secondarybaserid_f);
         } else {
-            disable(trusteddomainsid_f);
+            disable(trusteddomainname_f);
 
             if (IPA.trust_enabled) {
                 require(baserid_f);
diff --git a/ipatests/test_webui/task_range.py b/ipatests/test_webui/task_range.py
index d46d345f03a2b50730e3107ef6f7c2222da4465c..b71285d1e6056b11e3e74703a568be27973de3bc 100644
--- a/ipatests/test_webui/task_range.py
+++ b/ipatests/test_webui/task_range.py
@@ -59,13 +59,13 @@ class range_tasks(UI_driver):
         self.max_id = max_id
         self.max_rid = max_rid
 
-    def get_sid(self):
+    def get_domain(self):
         result = self.execute_api_from_ui('trust_find', [], {})
         trusts = result['result']['result']
-        sid = None
+        domain = None
         if trusts:
-            sid = trusts[0]['ipanttrusteddomainsid']
-        return sid
+            domain = trusts[0]['cn']
+        return domain
 
     def get_data(self, pkey, size=50, add_data=None):
 
@@ -81,7 +81,7 @@ class range_tasks(UI_driver):
         }
         return data
 
-    def get_add_data(self, pkey, range_type='ipa-local', size=50, shift=100, sid=None):
+    def get_add_data(self, pkey, range_type='ipa-local', size=50, shift=100, domain=None):
 
         base_id = self.max_id + shift
         self.max_id = base_id + size
@@ -98,19 +98,19 @@ class range_tasks(UI_driver):
             ('callback', self.check_range_type_mod, range_type)
         ]
 
-        if not sid:
+        if not domain:
             base_rid = self.max_rid + shift
             self.max_rid = base_rid + size
             add.append(('textbox', 'ipasecondarybaserid', str(base_rid)))
-        if sid:
-            add.append(('textbox', 'ipanttrusteddomainsid', sid))
+        if domain:
+            add.append(('textbox', 'ipanttrusteddomainname', domain))
 
         return add
 
     def check_range_type_mod(self, range_type):
         if range_type == 'ipa-local':
-            self.assert_disabled("[name=ipanttrusteddomainsid]")
+            self.assert_disabled("[name=ipanttrusteddomainname]")
             self.assert_disabled("[name=ipasecondarybaserid]", negative=True)
         elif range_type == 'ipa-ad-trust':
-            self.assert_disabled("[name=ipanttrusteddomainsid]", negative=True)
+            self.assert_disabled("[name=ipanttrusteddomainname]", negative=True)
             self.assert_disabled("[name=ipasecondarybaserid]")
diff --git a/ipatests/test_webui/test_range.py b/ipatests/test_webui/test_range.py
index 5c2e33b90833d5e03014e72fad302e58c986ca25..e1c46e50a85171bafabe80bd772ed9ac983a6ca4 100644
--- a/ipatests/test_webui/test_range.py
+++ b/ipatests/test_webui/test_range.py
@@ -74,11 +74,11 @@ class test_range(range_tasks):
 
             self.add_record(trust_mod.ENTITY, trust_data)
 
-            sid = self.get_sid()
+            domain = self.get_domain()
 
             self.navigate_to_entity(ENTITY)
 
-            add = self.get_add_data(pkey_ad, range_type='ipa-ad-trust', sid=sid)
+            add = self.get_add_data(pkey_ad, range_type='ipa-ad-trust', domain=domain)
             data = self.get_data(pkey_ad, add_data=add)
             self.add_record(ENTITY, data, navigate=False)
             self.assert_record_value('Active Directory domain range', pkey_ad, column)
-- 
2.1.0