URL: https://github.com/freeipa/freeipa/pull/331
Author: pvomacka
 Title: #331: WebUI: don't change casing of Auth Indicators values
Action: opened

PR body:
"""
All values were previously converted to lowercase which was not
coresponding with CLI behaviour. Now they stay as they are
inserted. I also have to change the strings to lowercase because
the otp and radius should be inserted as lowercase words.

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

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/331/head:pr331
git checkout pr331
From a0dd61fdd6f04a2e1079e9e9b1996c0547bb1742 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Tue, 13 Dec 2016 13:21:29 +0100
Subject: [PATCH 1/2] WebUI: Allow disabling lowering text in
 custom_checkbox_widget

Add new attribute which keeps information whether each text added
using custom_checkbox_widget shoud be transformed to lowercase.

Part of: https://fedorahosted.org/freeipa/ticket/6308
---
 install/ui/src/freeipa/widget.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 041eaa2..7965d9f 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -2509,6 +2509,9 @@ IPA.custom_checkboxes_widget = function(spec) {
 
     var that = IPA.checkboxes_widget(spec);
 
+    that.set_value_to_lowercase = spec.set_value_to_lowercase === undefined
+                                    ? true : spec.set_value_to_lowercase;
+
     that.add_dialog_title = spec.add_dialog_title ||
                             "@i18n:dialogs.add_custom_value";
     that.add_field_label = spec.add_field_label ||
@@ -2626,7 +2629,7 @@ IPA.custom_checkboxes_widget = function(spec) {
 
             if (!value || value === '') continue;
 
-            value = value.toLowerCase();
+            if (that.set_value_to_lowercase) value = value.toLowerCase();
             that.values.push(value);
         }
 

From e40d717ebfc8dac544d646951b22f3747ff2aad4 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Tue, 13 Dec 2016 13:25:48 +0100
Subject: [PATCH 2/2] WebUI: don't change casing of Auth Indicators values

All values were previously converted to lowercase which was not
coresponding with CLI behaviour. Now they stay as they are
inserted. I also have to change the strings to lowercase because
the otp and radius should be inserted as lowercase words.

https://fedorahosted.org/freeipa/ticket/6308
---
 install/ui/src/freeipa/host.js    | 1 +
 install/ui/src/freeipa/service.js | 5 +++--
 ipaserver/plugins/internal.py     | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 87cf264..a54cb8f 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -119,6 +119,7 @@ return {
                             $type: 'custom_checkboxes',
                             label: '@i18n:authtype.auth_indicators',
                             name: 'krbprincipalauthind',
+                            set_value_to_lowercase: false,
                             add_dialog_title: '@i18n:authtype.custom_auth_ind_title',
                             add_field_label: '@i18n:authtype.auth_indicator',
                             options: [
diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js
index a6607d2..a86205a 100644
--- a/install/ui/src/freeipa/service.js
+++ b/install/ui/src/freeipa/service.js
@@ -129,16 +129,17 @@ return {
                             $type: 'custom_checkboxes',
                             label: '@i18n:authtype.auth_indicators',
                             name: 'krbprincipalauthind',
+                            set_value_to_lowercase: false,
                             add_dialog_title: '@i18n:authtype.custom_auth_ind_title',
                             add_field_label: '@i18n:authtype.auth_indicator',
                             options: [
                                 {
                                     label: '@i18n:authtype.otp',
-                                    value: 'otp'
+                                    value: 'OTP'
                                 },
                                 {
                                     label: '@i18n:authtype.type_radius',
-                                    value: 'radius'
+                                    value: 'RADIUS'
                                 }
                             ],
                             tooltip: {
diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py
index 6107a14..74c264e 100644
--- a/ipaserver/plugins/internal.py
+++ b/ipaserver/plugins/internal.py
@@ -201,10 +201,10 @@ class i18n_messages(Command):
             "auth_indicator": _("Authentication indicator"),
             "config_tooltip": _("<p>Implicit method (password) will be used if no method is chosen.</p><p><strong>Password + Two-factor:</strong> LDAP and Kerberos allow authentication with either one of the authentication types but Kerberos uses pre-authentication method which requires to use armor ccache.</p><p><strong>RADIUS with another type:</strong> Kerberos always use RADIUS, but LDAP never does. LDAP only recognize the password and two-factor authentication options.</p>"),
             "custom_auth_ind_title": _("Add Custom Authentication Indicator"),
-            "otp": _("OTP"),
+            "otp": _("otp"),
             "type_otp": _("Two factor authentication (password + OTP)"),
             "type_password": _("Password"),
-            "type_radius": _("RADIUS"),
+            "type_radius": _("radius"),
             "type_disabled": _("Disable per-user override"),
             "user_tooltip": _("<p>Per-user setting, overwrites the global setting if any option is checked.</p><p><strong>Password + Two-factor:</strong> LDAP and Kerberos allow authentication with either one of the authentication types but Kerberos uses pre-authentication method which requires to use armor ccache.</p><p><strong>RADIUS with another type:</strong> Kerberos always use RADIUS, but LDAP never does. LDAP only recognize the password and two-factor authentication options.</p>"),
         },
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to