[pbs-devel] [RFC PATCH proxmox-widget-toolkit v2 15/15] window: ldap auth edit: add case-sensitive checkbox for AD realms

Christoph Heiss c.heiss at proxmox.com
Wed Aug 16 16:47:45 CEST 2023


Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Changes v1 -> v2:
  * New patch

 src/window/AuthEditLDAP.js | 40 ++++++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/window/AuthEditLDAP.js b/src/window/AuthEditLDAP.js
index 8cb7c80..810fe71 100644
--- a/src/window/AuthEditLDAP.js
+++ b/src/window/AuthEditLDAP.js
@@ -36,21 +36,28 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
 	    values.type = this.type;
 	}

-	if (values.anonymous_search) {
-	    if (!values.delete) {
-		values.delete = [];
-	    }
-
-	    if (!Array.isArray(values.delete)) {
-		let tmp = values.delete;
-		values.delete = [];
-		values.delete.push(tmp);
-	    }
+	if (!values.delete) {
+	    values.delete = [];
+	} else if (!Array.isArray(values.delete)) {
+	    let tmp = values.delete;
+	    values.delete = [];
+	    values.delete.push(tmp);
+	}

+	if (values.anonymous_search) {
 	    values.delete.push("bind-dn");
 	    values.delete.push("password");
 	}

+	if (values['case-sensitive']) {
+	    // Default is true, so delete if set ..
+	    values.delete.push('case-sensitive');
+	    delete values['case-sensitive'];
+	} else {
+	    // .. but if the checkbox is unticket, explicitly set to 0
+	    values['case-sensitive'] = 0;
+	}
+
 	delete values.anonymous_search;

 	return values;
@@ -92,6 +99,19 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
 		allowBlank: '{!isLdap}',
 	    },
 	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('Case-sensitive'),
+	    name: 'case-sensitive',
+	    value: 1,
+	    cbind: {
+		hidden: '{!isAd}',
+	    },
+	    autoEl: {
+		tag: 'div',
+		'data-qtip': gettext('Match usernames case-sensitive'),
+	    },
+	},
 	{
 	    xtype: 'proxmoxtextfield',
 	    fieldLabel: gettext('User Attribute Name'),
--
2.41.0






More information about the pbs-devel mailing list