From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <c.heiss@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 0A554CD6C
 for <pbs-devel@lists.proxmox.com>; Wed, 16 Aug 2023 16:49:07 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id E856E180CF
 for <pbs-devel@lists.proxmox.com>; Wed, 16 Aug 2023 16:49:05 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Wed, 16 Aug 2023 16:49:04 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A5CA441037
 for <pbs-devel@lists.proxmox.com>; Wed, 16 Aug 2023 16:49:04 +0200 (CEST)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Wed, 16 Aug 2023 16:47:45 +0200
Message-ID: <20230816144746.1265108-16-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20230816144746.1265108-1-c.heiss@proxmox.com>
References: <20230816144746.1265108-1-c.heiss@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.041 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] [RFC PATCH proxmox-widget-toolkit v2 15/15] window:
 ldap auth edit: add case-sensitive checkbox for AD realms
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 16 Aug 2023 14:49:07 -0000

Signed-off-by: Christoph Heiss <c.heiss@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