Passed
Push — master ( 326a04...579c70 )
by Blizzz
12:55 queued 11s
created
apps/user_ldap/lib/Group_LDAP.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 		if (!$this->enabled) {
102 102
 			return false;
103 103
 		}
104
-		$cacheKey = 'inGroup' . $uid . ':' . $gid;
104
+		$cacheKey = 'inGroup'.$uid.':'.$gid;
105 105
 		$inGroup = $this->access->connection->getFromCache($cacheKey);
106 106
 		if (!is_null($inGroup)) {
107
-			return (bool)$inGroup;
107
+			return (bool) $inGroup;
108 108
 		}
109 109
 
110 110
 		$userDN = $this->access->username2dn($uid);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			return in_array($userDN, $this->cachedGroupMembers[$gid]);
114 114
 		}
115 115
 
116
-		$cacheKeyMembers = 'inGroup-members:' . $gid;
116
+		$cacheKeyMembers = 'inGroup-members:'.$gid;
117 117
 		$members = $this->access->connection->getFromCache($cacheKeyMembers);
118 118
 		if (!is_null($members)) {
119 119
 			$this->cachedGroupMembers[$gid] = $members;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			return [];
242 242
 		}
243 243
 		// used extensively in cron job, caching makes sense for nested groups
244
-		$cacheKey = '_groupMembers' . $dnGroup;
244
+		$cacheKey = '_groupMembers'.$dnGroup;
245 245
 		$groupMembers = $this->access->connection->getFromCache($cacheKey);
246 246
 		if ($groupMembers !== null) {
247 247
 			return $groupMembers;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$seen[$dnGroup] = 1;
250 250
 		$members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr);
251 251
 		if (is_array($members)) {
252
-			$fetcher = function ($memberDN, &$seen) {
252
+			$fetcher = function($memberDN, &$seen) {
253 253
 				return $this->_groupMembers($memberDN, $seen);
254 254
 			};
255 255
 			$allMembers = $this->walkNestedGroups($dnGroup, $fetcher, $members);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			return [];
271 271
 		}
272 272
 
273
-		$fetcher = function ($groupDN) {
273
+		$fetcher = function($groupDN) {
274 274
 			if (isset($this->cachedNestedGroups[$groupDN])) {
275 275
 				$nestedGroups = $this->cachedNestedGroups[$groupDN];
276 276
 			} else {
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	}
289 289
 
290 290
 	private function walkNestedGroups(string $dn, Closure $fetcher, array $list): array {
291
-		$nesting = (int)$this->access->connection->ldapNestedGroups;
291
+		$nesting = (int) $this->access->connection->ldapNestedGroups;
292 292
 		// depending on the input, we either have a list of DNs or a list of LDAP records
293 293
 		// also, the output expects either DNs or records. Testing the first element should suffice.
294 294
 		$recordMode = is_array($list) && isset($list[0]) && is_array($list[0]) && isset($list[0]['dn'][0]);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		if ($nesting !== 1) {
297 297
 			if ($recordMode) {
298 298
 				// the keys are numeric, but should hold the DN
299
-				return array_reduce($list, function ($transformed, $record) use ($dn) {
299
+				return array_reduce($list, function($transformed, $record) use ($dn) {
300 300
 					if ($record['dn'][0] != $dn) {
301 301
 						$transformed[$record['dn'][0]] = $record;
302 302
 					}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @throws ServerNotAvailableException
330 330
 	 */
331 331
 	public function gidNumber2Name(string $gid, string $dn) {
332
-		$cacheKey = 'gidNumberToName' . $gid;
332
+		$cacheKey = 'gidNumberToName'.$gid;
333 333
 		$groupName = $this->access->connection->getFromCache($cacheKey);
334 334
 		if (!is_null($groupName) && isset($groupName)) {
335 335
 			return $groupName;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		$filter = $this->access->combineFilterWithAnd([
340 340
 			$this->access->connection->ldapGroupFilter,
341 341
 			'objectClass=posixGroup',
342
-			$this->access->connection->ldapGidNumber . '=' . $gid
342
+			$this->access->connection->ldapGidNumber.'='.$gid
343 343
 		]);
344 344
 		return $this->getNameOfGroup($filter, $cacheKey) ?? false;
345 345
 	}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		if ($search !== '') {
420 420
 			$filterParts[] = $this->access->getFilterPartForUserSearch($search);
421 421
 		}
422
-		$filterParts[] = $this->access->connection->ldapGidNumber . '=' . $groupID;
422
+		$filterParts[] = $this->access->connection->ldapGidNumber.'='.$groupID;
423 423
 
424 424
 		return $this->access->combineFilterWithAnd($filterParts);
425 425
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		//we need to get the DN from LDAP
490 490
 		$filter = $this->access->combineFilterWithAnd([
491 491
 			$this->access->connection->ldapGroupFilter,
492
-			'objectsid=' . $domainObjectSid . '-' . $gid
492
+			'objectsid='.$domainObjectSid.'-'.$gid
493 493
 		]);
494 494
 		return $this->getNameOfGroup($filter, $cacheKey) ?? false;
495 495
 	}
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		if ($search !== '') {
547 547
 			$filterParts[] = $this->access->getFilterPartForUserSearch($search);
548 548
 		}
549
-		$filterParts[] = 'primaryGroupID=' . $groupID;
549
+		$filterParts[] = 'primaryGroupID='.$groupID;
550 550
 
551 551
 		return $this->access->combineFilterWithAnd($filterParts);
552 552
 	}
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		try {
589 589
 			$filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search);
590 590
 			$users = $this->access->countUsers($filter, ['dn'], $limit, $offset);
591
-			return (int)$users;
591
+			return (int) $users;
592 592
 		} catch (ServerNotAvailableException $e) {
593 593
 			throw $e;
594 594
 		} catch (Exception $e) {
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		if (!$this->enabled) {
628 628
 			return [];
629 629
 		}
630
-		$cacheKey = 'getUserGroups' . $uid;
630
+		$cacheKey = 'getUserGroups'.$uid;
631 631
 		$userGroups = $this->access->connection->getFromCache($cacheKey);
632 632
 		if (!is_null($userGroups)) {
633 633
 			return $userGroups;
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 		// if possible, read out membership via memberOf. It's far faster than
686 686
 		// performing a search, which still is a fallback later.
687 687
 		// memberof doesn't support memberuid, so skip it here.
688
-		if ((int)$this->access->connection->hasMemberOfFilterSupport === 1
689
-			&& (int)$this->access->connection->useMemberOfToDetectMembership === 1
688
+		if ((int) $this->access->connection->hasMemberOfFilterSupport === 1
689
+			&& (int) $this->access->connection->useMemberOfToDetectMembership === 1
690 690
 			&& $this->ldapGroupMemberAssocAttr !== 'memberuid'
691 691
 			&& $this->ldapGroupMemberAssocAttr !== 'zimbramailforwardingaddress') {
692 692
 			$groupDNs = $this->_getGroupDNsFromMemberOf($userDN);
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 		}
779 779
 		$allGroups = [];
780 780
 		$seen[$dn] = true;
781
-		$filter = $this->access->connection->ldapGroupMemberAssocAttr . '=' . $dn;
781
+		$filter = $this->access->connection->ldapGroupMemberAssocAttr.'='.$dn;
782 782
 
783 783
 		if ($this->ldapGroupMemberAssocAttr === 'zimbramailforwardingaddress') {
784 784
 			//in this case the member entries are email addresses
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		$groups = $this->access->fetchListOfGroups($filter,
789 789
 			[strtolower($this->access->connection->ldapGroupMemberAssocAttr), $this->access->connection->ldapGroupDisplayName, 'dn']);
790 790
 		if (is_array($groups)) {
791
-			$fetcher = function ($dn, &$seen) {
791
+			$fetcher = function($dn, &$seen) {
792 792
 				if (is_array($dn) && isset($dn['dn'][0])) {
793 793
 					$dn = $dn['dn'][0];
794 794
 				}
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 			return [];
825 825
 		}
826 826
 		$search = $this->access->escapeFilterPart($search, true);
827
-		$cacheKey = 'usersInGroup-' . $gid . '-' . $search . '-' . $limit . '-' . $offset;
827
+		$cacheKey = 'usersInGroup-'.$gid.'-'.$search.'-'.$limit.'-'.$offset;
828 828
 		// check for cache of the exact query
829 829
 		$groupUsers = $this->access->connection->getFromCache($cacheKey);
830 830
 		if (!is_null($groupUsers)) {
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 			$limit = null;
836 836
 		}
837 837
 		// check for cache of the query without limit and offset
838
-		$groupUsers = $this->access->connection->getFromCache('usersInGroup-' . $gid . '-' . $search);
838
+		$groupUsers = $this->access->connection->getFromCache('usersInGroup-'.$gid.'-'.$search);
839 839
 		if (!is_null($groupUsers)) {
840 840
 			$groupUsers = array_slice($groupUsers, $offset, $limit);
841 841
 			$this->access->connection->writeToCache($cacheKey, $groupUsers);
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 						continue;
890 890
 					}
891 891
 
892
-					$cacheKey = 'userExistsOnLDAP' . $uid;
892
+					$cacheKey = 'userExistsOnLDAP'.$uid;
893 893
 					$userExists = $this->access->connection->getFromCache($cacheKey);
894 894
 					if ($userExists === false) {
895 895
 						continue;
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
 		$groupUsers = array_unique(array_merge($groupUsers, $primaryUsers, $posixGroupUsers));
917 917
 		natsort($groupUsers);
918
-		$this->access->connection->writeToCache('usersInGroup-' . $gid . '-' . $search, $groupUsers);
918
+		$this->access->connection->writeToCache('usersInGroup-'.$gid.'-'.$search, $groupUsers);
919 919
 		$groupUsers = array_slice($groupUsers, $offset, $limit);
920 920
 
921 921
 		$this->access->connection->writeToCache($cacheKey, $groupUsers);
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 			return $this->groupPluginManager->countUsersInGroup($gid, $search);
938 938
 		}
939 939
 
940
-		$cacheKey = 'countUsersInGroup-' . $gid . '-' . $search;
940
+		$cacheKey = 'countUsersInGroup-'.$gid.'-'.$search;
941 941
 		if (!$this->enabled || !$this->groupExists($gid)) {
942 942
 			return false;
943 943
 		}
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 		if (!$this->enabled) {
1036 1036
 			return [];
1037 1037
 		}
1038
-		$cacheKey = 'getGroups-' . $search . '-' . $limit . '-' . $offset;
1038
+		$cacheKey = 'getGroups-'.$search.'-'.$limit.'-'.$offset;
1039 1039
 
1040 1040
 		//Check cache before driving unnecessary searches
1041 1041
 		$ldap_groups = $this->access->connection->getFromCache($cacheKey);
@@ -1070,31 +1070,31 @@  discard block
 block discarded – undo
1070 1070
 	 * @throws ServerNotAvailableException
1071 1071
 	 */
1072 1072
 	public function groupExists($gid) {
1073
-		$groupExists = $this->access->connection->getFromCache('groupExists' . $gid);
1073
+		$groupExists = $this->access->connection->getFromCache('groupExists'.$gid);
1074 1074
 		if (!is_null($groupExists)) {
1075
-			return (bool)$groupExists;
1075
+			return (bool) $groupExists;
1076 1076
 		}
1077 1077
 
1078 1078
 		//getting dn, if false the group does not exist. If dn, it may be mapped
1079 1079
 		//only, requires more checking.
1080 1080
 		$dn = $this->access->groupname2dn($gid);
1081 1081
 		if (!$dn) {
1082
-			$this->access->connection->writeToCache('groupExists' . $gid, false);
1082
+			$this->access->connection->writeToCache('groupExists'.$gid, false);
1083 1083
 			return false;
1084 1084
 		}
1085 1085
 
1086 1086
 		if (!$this->access->isDNPartOfBase($dn, $this->access->connection->ldapBaseGroups)) {
1087
-			$this->access->connection->writeToCache('groupExists' . $gid, false);
1087
+			$this->access->connection->writeToCache('groupExists'.$gid, false);
1088 1088
 			return false;
1089 1089
 		}
1090 1090
 
1091 1091
 		//if group really still exists, we will be able to read its objectClass
1092 1092
 		if (!is_array($this->access->readAttribute($dn, '', $this->access->connection->ldapGroupFilter))) {
1093
-			$this->access->connection->writeToCache('groupExists' . $gid, false);
1093
+			$this->access->connection->writeToCache('groupExists'.$gid, false);
1094 1094
 			return false;
1095 1095
 		}
1096 1096
 
1097
-		$this->access->connection->writeToCache('groupExists' . $gid, true);
1097
+		$this->access->connection->writeToCache('groupExists'.$gid, true);
1098 1098
 		return true;
1099 1099
 	}
1100 1100
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	 * compared with GroupInterface::CREATE_GROUP etc.
1128 1128
 	 */
1129 1129
 	public function implementsActions($actions) {
1130
-		return (bool)((GroupInterface::COUNT_USERS |
1130
+		return (bool) ((GroupInterface::COUNT_USERS |
1131 1131
 				$this->groupPluginManager->getImplementedActions()) & $actions);
1132 1132
 	}
1133 1133
 
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			if ($ret = $this->groupPluginManager->deleteGroup($gid)) {
1182 1182
 				#delete group in nextcloud internal db
1183 1183
 				$this->access->getGroupMapper()->unmap($gid);
1184
-				$this->access->connection->writeToCache("groupExists" . $gid, false);
1184
+				$this->access->connection->writeToCache("groupExists".$gid, false);
1185 1185
 			}
1186 1186
 			return $ret;
1187 1187
 		}
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 			return $this->groupPluginManager->getDisplayName($gid);
1263 1263
 		}
1264 1264
 
1265
-		$cacheKey = 'group_getDisplayName' . $gid;
1265
+		$cacheKey = 'group_getDisplayName'.$gid;
1266 1266
 		if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) {
1267 1267
 			return $displayName;
1268 1268
 		}
Please login to merge, or discard this patch.
apps/user_ldap/templates/settings.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -59,43 +59,43 @@  discard block
 block discarded – undo
59 59
 
60 60
 	<div id="ldapSettings">
61 61
 	<ul>
62
-		<li id="#ldapWizard1"><a href="#ldapWizard1"><?php p($l->t('Server'));?></a></li>
63
-		<li id="#ldapWizard2"><a href="#ldapWizard2"><?php p($l->t('Users'));?></a></li>
64
-		<li id="#ldapWizard3"><a href="#ldapWizard3"><?php p($l->t('Login Attributes'));?></a></li>
65
-		<li id="#ldapWizard4"><a href="#ldapWizard4"><?php p($l->t('Groups'));?></a></li>
66
-		<li class="ldapSettingsTabs"><a href="#ldapSettings-2"><?php p($l->t('Expert'));?></a></li>
67
-		<li class="ldapSettingsTabs"><a href="#ldapSettings-1"><?php p($l->t('Advanced'));?></a></li>
62
+		<li id="#ldapWizard1"><a href="#ldapWizard1"><?php p($l->t('Server')); ?></a></li>
63
+		<li id="#ldapWizard2"><a href="#ldapWizard2"><?php p($l->t('Users')); ?></a></li>
64
+		<li id="#ldapWizard3"><a href="#ldapWizard3"><?php p($l->t('Login Attributes')); ?></a></li>
65
+		<li id="#ldapWizard4"><a href="#ldapWizard4"><?php p($l->t('Groups')); ?></a></li>
66
+		<li class="ldapSettingsTabs"><a href="#ldapSettings-2"><?php p($l->t('Expert')); ?></a></li>
67
+		<li class="ldapSettingsTabs"><a href="#ldapSettings-1"><?php p($l->t('Advanced')); ?></a></li>
68 68
 	</ul>
69 69
 	<?php
70 70
 	if (!function_exists('ldap_connect')) {
71 71
 		print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.').'</p>');
72 72
 	}
73 73
 	?>
74
-	<?php require_once __DIR__ . '/part.wizard-server.php'; ?>
75
-	<?php require_once __DIR__ . '/part.wizard-userfilter.php'; ?>
76
-	<?php require_once __DIR__ . '/part.wizard-loginfilter.php'; ?>
77
-	<?php require_once __DIR__ . '/part.wizard-groupfilter.php'; ?>
74
+	<?php require_once __DIR__.'/part.wizard-server.php'; ?>
75
+	<?php require_once __DIR__.'/part.wizard-userfilter.php'; ?>
76
+	<?php require_once __DIR__.'/part.wizard-loginfilter.php'; ?>
77
+	<?php require_once __DIR__.'/part.wizard-groupfilter.php'; ?>
78 78
 	<fieldset id="ldapSettings-1">
79 79
 		<div id="ldapAdvancedAccordion">
80
-			<h3><?php p($l->t('Connection Settings'));?></h3>
80
+			<h3><?php p($l->t('Connection Settings')); ?></h3>
81 81
 			<div>
82
-				<p><label for="ldap_configuration_active"><?php p($l->t('Configuration Active'));?></label><input type="checkbox" id="ldap_configuration_active" name="ldap_configuration_active" value="1" data-default="<?php p($_['ldap_configuration_active_default']); ?>"  title="<?php p($l->t('When unchecked, this configuration will be skipped.'));?>" /></p>
83
-				<p><label for="ldap_backup_host"><?php p($l->t('Backup (Replica) Host'));?></label><input type="text" id="ldap_backup_host" name="ldap_backup_host" data-default="<?php p($_['ldap_backup_host_default']); ?>" title="<?php p($l->t('Give an optional backup host. It must be a replica of the main LDAP/AD server.'));?>"></p>
84
-				<p><label for="ldap_backup_port"><?php p($l->t('Backup (Replica) Port'));?></label><input type="number" id="ldap_backup_port" name="ldap_backup_port" data-default="<?php p($_['ldap_backup_port_default']); ?>"  /></p>
85
-				<p><label for="ldap_override_main_server"><?php p($l->t('Disable Main Server'));?></label><input type="checkbox" id="ldap_override_main_server" name="ldap_override_main_server" value="1" data-default="<?php p($_['ldap_override_main_server_default']); ?>"  title="<?php p($l->t('Only connect to the replica server.'));?>" /></p>
86
-				<p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.'));?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('Not recommended, use it for testing only! If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', [$theme->getName()]));?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/></p>
87
-				<p><label for="ldap_cache_ttl"><?php p($l->t('Cache Time-To-Live'));?></label><input type="number" id="ldap_cache_ttl" name="ldap_cache_ttl" title="<?php p($l->t('in seconds. A change empties the cache.'));?>" data-default="<?php p($_['ldap_cache_ttl_default']); ?>" /></p>
82
+				<p><label for="ldap_configuration_active"><?php p($l->t('Configuration Active')); ?></label><input type="checkbox" id="ldap_configuration_active" name="ldap_configuration_active" value="1" data-default="<?php p($_['ldap_configuration_active_default']); ?>"  title="<?php p($l->t('When unchecked, this configuration will be skipped.')); ?>" /></p>
83
+				<p><label for="ldap_backup_host"><?php p($l->t('Backup (Replica) Host')); ?></label><input type="text" id="ldap_backup_host" name="ldap_backup_host" data-default="<?php p($_['ldap_backup_host_default']); ?>" title="<?php p($l->t('Give an optional backup host. It must be a replica of the main LDAP/AD server.')); ?>"></p>
84
+				<p><label for="ldap_backup_port"><?php p($l->t('Backup (Replica) Port')); ?></label><input type="number" id="ldap_backup_port" name="ldap_backup_port" data-default="<?php p($_['ldap_backup_port_default']); ?>"  /></p>
85
+				<p><label for="ldap_override_main_server"><?php p($l->t('Disable Main Server')); ?></label><input type="checkbox" id="ldap_override_main_server" name="ldap_override_main_server" value="1" data-default="<?php p($_['ldap_override_main_server_default']); ?>"  title="<?php p($l->t('Only connect to the replica server.')); ?>" /></p>
86
+				<p><label for="ldap_turn_off_cert_check"><?php p($l->t('Turn off SSL certificate validation.')); ?></label><input type="checkbox" id="ldap_turn_off_cert_check" name="ldap_turn_off_cert_check" title="<?php p($l->t('Not recommended, use it for testing only! If connection only works with this option, import the LDAP server\'s SSL certificate in your %s server.', [$theme->getName()])); ?>" data-default="<?php p($_['ldap_turn_off_cert_check_default']); ?>" value="1"><br/></p>
87
+				<p><label for="ldap_cache_ttl"><?php p($l->t('Cache Time-To-Live')); ?></label><input type="number" id="ldap_cache_ttl" name="ldap_cache_ttl" title="<?php p($l->t('in seconds. A change empties the cache.')); ?>" data-default="<?php p($_['ldap_cache_ttl_default']); ?>" /></p>
88 88
 			</div>
89
-			<h3><?php p($l->t('Directory Settings'));?></h3>
89
+			<h3><?php p($l->t('Directory Settings')); ?></h3>
90 90
 			<div>
91
-				<p><label for="ldap_display_name"><?php p($l->t('User Display Name Field'));?></label><input type="text" id="ldap_display_name" name="ldap_display_name" data-default="<?php p($_['ldap_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the user\'s display name.'));?>" /></p>
92
-				<p><label for="ldap_user_display_name_2"><?php p($l->t('2nd User Display Name Field'));?></label><input type="text" id="ldap_user_display_name_2" name="ldap_user_display_name_2" data-default="<?php p($_['ldap_user_display_name_2_default']); ?>" title="<?php p($l->t('Optional. An LDAP attribute to be added to the display name in brackets. Results in e.g. »John Doe ([email protected])«.'));?>" /></p>
93
-				<p><label for="ldap_base_users"><?php p($l->t('Base User Tree'));?></label><textarea id="ldap_base_users" name="ldap_base_users" placeholder="<?php p($l->t('One User Base DN per line'));?>" data-default="<?php p($_['ldap_base_users_default']); ?>" title="<?php p($l->t('Base User Tree'));?>"></textarea></p>
94
-				<p><label for="ldap_attributes_for_user_search"><?php p($l->t('User Search Attributes'));?></label><textarea id="ldap_attributes_for_user_search" name="ldap_attributes_for_user_search" placeholder="<?php p($l->t('Optional; one attribute per line'));?>" data-default="<?php p($_['ldap_attributes_for_user_search_default']); ?>" title="<?php p($l->t('User Search Attributes'));?>"></textarea></p>
95
-				<p><label for="ldap_group_display_name"><?php p($l->t('Group Display Name Field'));?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" data-default="<?php p($_['ldap_group_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the groups\'s display name.'));?>" /></p>
96
-				<p><label for="ldap_base_groups"><?php p($l->t('Base Group Tree'));?></label><textarea id="ldap_base_groups" name="ldap_base_groups" placeholder="<?php p($l->t('One Group Base DN per line'));?>" data-default="<?php p($_['ldap_base_groups_default']); ?>" title="<?php p($l->t('Base Group Tree'));?>"></textarea></p>
97
-				<p><label for="ldap_attributes_for_group_search"><?php p($l->t('Group Search Attributes'));?></label><textarea id="ldap_attributes_for_group_search" name="ldap_attributes_for_group_search" placeholder="<?php p($l->t('Optional; one attribute per line'));?>" data-default="<?php p($_['ldap_attributes_for_group_search_default']); ?>" title="<?php p($l->t('Group Search Attributes'));?>"></textarea></p>
98
-				<p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association'));?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'uniqueMember')) {
91
+				<p><label for="ldap_display_name"><?php p($l->t('User Display Name Field')); ?></label><input type="text" id="ldap_display_name" name="ldap_display_name" data-default="<?php p($_['ldap_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the user\'s display name.')); ?>" /></p>
92
+				<p><label for="ldap_user_display_name_2"><?php p($l->t('2nd User Display Name Field')); ?></label><input type="text" id="ldap_user_display_name_2" name="ldap_user_display_name_2" data-default="<?php p($_['ldap_user_display_name_2_default']); ?>" title="<?php p($l->t('Optional. An LDAP attribute to be added to the display name in brackets. Results in e.g. »John Doe ([email protected])«.')); ?>" /></p>
93
+				<p><label for="ldap_base_users"><?php p($l->t('Base User Tree')); ?></label><textarea id="ldap_base_users" name="ldap_base_users" placeholder="<?php p($l->t('One User Base DN per line')); ?>" data-default="<?php p($_['ldap_base_users_default']); ?>" title="<?php p($l->t('Base User Tree')); ?>"></textarea></p>
94
+				<p><label for="ldap_attributes_for_user_search"><?php p($l->t('User Search Attributes')); ?></label><textarea id="ldap_attributes_for_user_search" name="ldap_attributes_for_user_search" placeholder="<?php p($l->t('Optional; one attribute per line')); ?>" data-default="<?php p($_['ldap_attributes_for_user_search_default']); ?>" title="<?php p($l->t('User Search Attributes')); ?>"></textarea></p>
95
+				<p><label for="ldap_group_display_name"><?php p($l->t('Group Display Name Field')); ?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" data-default="<?php p($_['ldap_group_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the groups\'s display name.')); ?>" /></p>
96
+				<p><label for="ldap_base_groups"><?php p($l->t('Base Group Tree')); ?></label><textarea id="ldap_base_groups" name="ldap_base_groups" placeholder="<?php p($l->t('One Group Base DN per line')); ?>" data-default="<?php p($_['ldap_base_groups_default']); ?>" title="<?php p($l->t('Base Group Tree')); ?>"></textarea></p>
97
+				<p><label for="ldap_attributes_for_group_search"><?php p($l->t('Group Search Attributes')); ?></label><textarea id="ldap_attributes_for_group_search" name="ldap_attributes_for_group_search" placeholder="<?php p($l->t('Optional; one attribute per line')); ?>" data-default="<?php p($_['ldap_attributes_for_group_search_default']); ?>" title="<?php p($l->t('Group Search Attributes')); ?>"></textarea></p>
98
+				<p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association')); ?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'uniqueMember')) {
99 99
 		p(' selected');
100 100
 	} ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'memberUid')) {
101 101
 		p(' selected');
@@ -106,35 +106,35 @@  discard block
 block discarded – undo
106 106
 	} ?>>gidNumber</option><option value="zimbraMailForwardingAddress"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'zimbraMailForwardingAddress')) {
107 107
 		p(' selected');
108 108
 	} ?>>zimbraMailForwardingAddress</option></select></p>
109
-				<p><label for="ldap_dynamic_group_member_url"><?php p($l->t('Dynamic Group Member URL'));?></label><input type="text" id="ldap_dynamic_group_member_url" name="ldap_dynamic_group_member_url" title="<?php p($l->t('The LDAP attribute that on group objects contains an LDAP search URL that determines what objects belong to the group. (An empty setting disables dynamic group membership functionality.)'));?>" data-default="<?php p($_['ldap_dynamic_group_member_url_default']); ?>" /></p>
110
-				<p><label for="ldap_nested_groups"><?php p($l->t('Nested Groups'));?></label><input type="checkbox" id="ldap_nested_groups" name="ldap_nested_groups" value="1" data-default="<?php p($_['ldap_nested_groups_default']); ?>"  title="<?php p($l->t('When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)'));?>" /></p>
111
-				<p><label for="ldap_paging_size"><?php p($l->t('Paging chunksize'));?></label><input type="number" id="ldap_paging_size" name="ldap_paging_size" title="<?php p($l->t('Chunksize used for paged LDAP searches that may return bulky results like user or group enumeration. (Setting it 0 disables paged LDAP searches in those situations.)'));?>" data-default="<?php p($_['ldap_paging_size_default']); ?>" /></p>
112
-				<p><label for="ldap_turn_on_pwd_change"><?php p($l->t('Enable LDAP password changes per user'));?></label><span class="inlinetable"><span class="tablerow left"><input type="checkbox" id="ldap_turn_on_pwd_change" name="ldap_turn_on_pwd_change" value="1" data-default="<?php p($_['ldap_turn_on_pwd_change_default']); ?>" title="<?php p($l->t('Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server.'));?>" /><span class="tablecell"><?php p($l->t('(New password is sent as plain text to LDAP)'));?></span></span>
109
+				<p><label for="ldap_dynamic_group_member_url"><?php p($l->t('Dynamic Group Member URL')); ?></label><input type="text" id="ldap_dynamic_group_member_url" name="ldap_dynamic_group_member_url" title="<?php p($l->t('The LDAP attribute that on group objects contains an LDAP search URL that determines what objects belong to the group. (An empty setting disables dynamic group membership functionality.)')); ?>" data-default="<?php p($_['ldap_dynamic_group_member_url_default']); ?>" /></p>
110
+				<p><label for="ldap_nested_groups"><?php p($l->t('Nested Groups')); ?></label><input type="checkbox" id="ldap_nested_groups" name="ldap_nested_groups" value="1" data-default="<?php p($_['ldap_nested_groups_default']); ?>"  title="<?php p($l->t('When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)')); ?>" /></p>
111
+				<p><label for="ldap_paging_size"><?php p($l->t('Paging chunksize')); ?></label><input type="number" id="ldap_paging_size" name="ldap_paging_size" title="<?php p($l->t('Chunksize used for paged LDAP searches that may return bulky results like user or group enumeration. (Setting it 0 disables paged LDAP searches in those situations.)')); ?>" data-default="<?php p($_['ldap_paging_size_default']); ?>" /></p>
112
+				<p><label for="ldap_turn_on_pwd_change"><?php p($l->t('Enable LDAP password changes per user')); ?></label><span class="inlinetable"><span class="tablerow left"><input type="checkbox" id="ldap_turn_on_pwd_change" name="ldap_turn_on_pwd_change" value="1" data-default="<?php p($_['ldap_turn_on_pwd_change_default']); ?>" title="<?php p($l->t('Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server.')); ?>" /><span class="tablecell"><?php p($l->t('(New password is sent as plain text to LDAP)')); ?></span></span>
113 113
 			</span><br/></p>
114
-				<p><label for="ldap_default_ppolicy_dn"><?php p($l->t('Default password policy DN'));?></label><input type="text" id="ldap_default_ppolicy_dn" name="ldap_default_ppolicy_dn" title="<?php p($l->t('The DN of a default password policy that will be used for password expiry handling. Works only when LDAP password changes per user are enabled and is only supported by OpenLDAP. Leave empty to disable password expiry handling.'));?>" data-default="<?php p($_['ldap_default_ppolicy_dn_default']); ?>" /></p>
114
+				<p><label for="ldap_default_ppolicy_dn"><?php p($l->t('Default password policy DN')); ?></label><input type="text" id="ldap_default_ppolicy_dn" name="ldap_default_ppolicy_dn" title="<?php p($l->t('The DN of a default password policy that will be used for password expiry handling. Works only when LDAP password changes per user are enabled and is only supported by OpenLDAP. Leave empty to disable password expiry handling.')); ?>" data-default="<?php p($_['ldap_default_ppolicy_dn_default']); ?>" /></p>
115 115
 			</div>
116
-			<h3><?php p($l->t('Special Attributes'));?></h3>
116
+			<h3><?php p($l->t('Special Attributes')); ?></h3>
117 117
 			<div>
118
-				<p><label for="ldap_quota_attr"><?php p($l->t('Quota Field'));?></label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" data-default="<?php p($_['ldap_quota_attr_default']); ?>" title="<?php p($l->t('Leave empty for user\'s default quota. Otherwise, specify an LDAP/AD attribute.'));?>" /></p>
119
-				<p><label for="ldap_quota_def"><?php p($l->t('Quota Default'));?></label><input type="text" id="ldap_quota_def" name="ldap_quota_def" data-default="<?php p($_['ldap_quota_def_default']); ?>" title="<?php p($l->t('Override default quota for LDAP users who do not have a quota set in the Quota Field.'));?>" /></p>
120
-				<p><label for="ldap_email_attr"><?php p($l->t('Email Field'));?></label><input type="text" id="ldap_email_attr" name="ldap_email_attr" data-default="<?php p($_['ldap_email_attr_default']); ?>" title="<?php p($l->t('Set the user\'s email from their LDAP attribute. Leave it empty for default behaviour.'));?>" /></p>
121
-				<p><label for="home_folder_naming_rule"><?php p($l->t('User Home Folder Naming Rule'));?></label><input type="text" id="home_folder_naming_rule" name="home_folder_naming_rule" title="<?php p($l->t('Leave empty for username (default). Otherwise, specify an LDAP/AD attribute.'));?>" data-default="<?php p($_['home_folder_naming_rule_default']); ?>" /></p>
118
+				<p><label for="ldap_quota_attr"><?php p($l->t('Quota Field')); ?></label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" data-default="<?php p($_['ldap_quota_attr_default']); ?>" title="<?php p($l->t('Leave empty for user\'s default quota. Otherwise, specify an LDAP/AD attribute.')); ?>" /></p>
119
+				<p><label for="ldap_quota_def"><?php p($l->t('Quota Default')); ?></label><input type="text" id="ldap_quota_def" name="ldap_quota_def" data-default="<?php p($_['ldap_quota_def_default']); ?>" title="<?php p($l->t('Override default quota for LDAP users who do not have a quota set in the Quota Field.')); ?>" /></p>
120
+				<p><label for="ldap_email_attr"><?php p($l->t('Email Field')); ?></label><input type="text" id="ldap_email_attr" name="ldap_email_attr" data-default="<?php p($_['ldap_email_attr_default']); ?>" title="<?php p($l->t('Set the user\'s email from their LDAP attribute. Leave it empty for default behaviour.')); ?>" /></p>
121
+				<p><label for="home_folder_naming_rule"><?php p($l->t('User Home Folder Naming Rule')); ?></label><input type="text" id="home_folder_naming_rule" name="home_folder_naming_rule" title="<?php p($l->t('Leave empty for username (default). Otherwise, specify an LDAP/AD attribute.')); ?>" data-default="<?php p($_['home_folder_naming_rule_default']); ?>" /></p>
122 122
 				<p><label for="ldap_ext_storage_home_attribute"> <?php p($l->t('"$home" Placeholder Field')); ?></label><input type="text" id="ldap_ext_storage_home_attribute" name="ldap_ext_storage_home_attribute" title="<?php p($l->t('$home in an external storage configuration will be replaced with the value of the specified attribute')); ?>" data-default="<?php p($_['ldap_ext_storage_home_attribute_default']); ?>"></p>
123 123
 			</div>
124 124
 		</div>
125 125
 		<?php print_unescaped($_['settingControls']); ?>
126 126
 	</fieldset>
127 127
 	<fieldset id="ldapSettings-2">
128
-		<p><strong><?php p($l->t('Internal Username'));?></strong></p>
129
-		<p class="ldapIndent"><?php p($l->t('By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ].  Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users.'));?></p>
130
-		<p class="ldapIndent"><label for="ldap_expert_username_attr"><?php p($l->t('Internal Username Attribute:'));?></label><input type="text" id="ldap_expert_username_attr" name="ldap_expert_username_attr" data-default="<?php p($_['ldap_expert_username_attr_default']); ?>" /></p>
131
-		<p><strong><?php p($l->t('Override UUID detection'));?></strong></p>
132
-		<p class="ldapIndent"><?php p($l->t('By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups.'));?></p>
133
-		<p class="ldapIndent"><label for="ldap_expert_uuid_user_attr"><?php p($l->t('UUID Attribute for Users:'));?></label><input type="text" id="ldap_expert_uuid_user_attr" name="ldap_expert_uuid_user_attr" data-default="<?php p($_['ldap_expert_uuid_user_attr_default']); ?>" /></p>
134
-		<p class="ldapIndent"><label for="ldap_expert_uuid_group_attr"><?php p($l->t('UUID Attribute for Groups:'));?></label><input type="text" id="ldap_expert_uuid_group_attr" name="ldap_expert_uuid_group_attr" data-default="<?php p($_['ldap_expert_uuid_group_attr_default']); ?>" /></p>
135
-		<p><strong><?php p($l->t('Username-LDAP User Mapping'));?></strong></p>
136
-		<p class="ldapIndent"><?php p($l->t('Usernames are used to store and assign metadata. In order to precisely identify and recognize users, each LDAP user will have an internal username. This requires a mapping from username to LDAP user. The created username is mapped to the UUID of the LDAP user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If the DN changes, the changes will be found. The internal username is used all over. Clearing the mappings will have leftovers everywhere. Clearing the mappings is not configuration sensitive, it affects all LDAP configurations! Never clear the mappings in a production environment, only in a testing or experimental stage.'));?></p>
137
-		<p class="ldapIndent"><button type="button" id="ldap_action_clear_user_mappings" name="ldap_action_clear_user_mappings"><?php p($l->t('Clear Username-LDAP User Mapping'));?></button><br/><button type="button" id="ldap_action_clear_group_mappings" name="ldap_action_clear_group_mappings"><?php p($l->t('Clear Groupname-LDAP Group Mapping'));?></button></p>
128
+		<p><strong><?php p($l->t('Internal Username')); ?></strong></p>
129
+		<p class="ldapIndent"><?php p($l->t('By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ].  Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users.')); ?></p>
130
+		<p class="ldapIndent"><label for="ldap_expert_username_attr"><?php p($l->t('Internal Username Attribute:')); ?></label><input type="text" id="ldap_expert_username_attr" name="ldap_expert_username_attr" data-default="<?php p($_['ldap_expert_username_attr_default']); ?>" /></p>
131
+		<p><strong><?php p($l->t('Override UUID detection')); ?></strong></p>
132
+		<p class="ldapIndent"><?php p($l->t('By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups.')); ?></p>
133
+		<p class="ldapIndent"><label for="ldap_expert_uuid_user_attr"><?php p($l->t('UUID Attribute for Users:')); ?></label><input type="text" id="ldap_expert_uuid_user_attr" name="ldap_expert_uuid_user_attr" data-default="<?php p($_['ldap_expert_uuid_user_attr_default']); ?>" /></p>
134
+		<p class="ldapIndent"><label for="ldap_expert_uuid_group_attr"><?php p($l->t('UUID Attribute for Groups:')); ?></label><input type="text" id="ldap_expert_uuid_group_attr" name="ldap_expert_uuid_group_attr" data-default="<?php p($_['ldap_expert_uuid_group_attr_default']); ?>" /></p>
135
+		<p><strong><?php p($l->t('Username-LDAP User Mapping')); ?></strong></p>
136
+		<p class="ldapIndent"><?php p($l->t('Usernames are used to store and assign metadata. In order to precisely identify and recognize users, each LDAP user will have an internal username. This requires a mapping from username to LDAP user. The created username is mapped to the UUID of the LDAP user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If the DN changes, the changes will be found. The internal username is used all over. Clearing the mappings will have leftovers everywhere. Clearing the mappings is not configuration sensitive, it affects all LDAP configurations! Never clear the mappings in a production environment, only in a testing or experimental stage.')); ?></p>
137
+		<p class="ldapIndent"><button type="button" id="ldap_action_clear_user_mappings" name="ldap_action_clear_user_mappings"><?php p($l->t('Clear Username-LDAP User Mapping')); ?></button><br/><button type="button" id="ldap_action_clear_group_mappings" name="ldap_action_clear_group_mappings"><?php p($l->t('Clear Groupname-LDAP Group Mapping')); ?></button></p>
138 138
 		<?php print_unescaped($_['settingControls']); ?>
139 139
 	</fieldset>
140 140
 	</div>
Please login to merge, or discard this patch.