@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @throws \Exception |
111 | 111 | */ |
112 | 112 | public function loginName2UserName($loginName) { |
113 | - $cacheKey = 'loginName2UserName-' . $loginName; |
|
113 | + $cacheKey = 'loginName2UserName-'.$loginName; |
|
114 | 114 | $username = $this->access->connection->getFromCache($cacheKey); |
115 | 115 | |
116 | 116 | if ($username !== null) { |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $attrs = $this->access->userManager->getAttributes(); |
158 | 158 | $users = $this->access->fetchUsersByLoginName($loginName, $attrs); |
159 | 159 | if (count($users) < 1) { |
160 | - throw new NotOnLDAP('No user available for the given login name on ' . |
|
161 | - $this->access->connection->ldapHost . ':' . $this->access->connection->ldapPort); |
|
160 | + throw new NotOnLDAP('No user available for the given login name on '. |
|
161 | + $this->access->connection->ldapHost.':'.$this->access->connection->ldapPort); |
|
162 | 162 | } |
163 | 163 | return $users[0]; |
164 | 164 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | if (!$user instanceof User) { |
184 | 184 | Util::writeLog('user_ldap', |
185 | - 'LDAP Login: Could not get user object for DN ' . $dn . |
|
185 | + 'LDAP Login: Could not get user object for DN '.$dn. |
|
186 | 186 | '. Maybe the LDAP entry has no set display name attribute?', |
187 | 187 | ILogger::WARN); |
188 | 188 | return false; |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | $user = $this->access->userManager->get($uid); |
218 | 218 | |
219 | 219 | if (!$user instanceof User) { |
220 | - throw new \Exception('LDAP setPassword: Could not get user object for uid ' . $uid . |
|
220 | + throw new \Exception('LDAP setPassword: Could not get user object for uid '.$uid. |
|
221 | 221 | '. Maybe the LDAP entry has no set display name attribute?'); |
222 | 222 | } |
223 | 223 | if ($user->getUsername() !== false && $this->access->setPassword($user->getDN(), $password)) { |
224 | 224 | $ldapDefaultPPolicyDN = $this->access->connection->ldapDefaultPPolicyDN; |
225 | 225 | $turnOnPasswordChange = $this->access->connection->turnOnPasswordChange; |
226 | - if (!empty($ldapDefaultPPolicyDN) && ((int)$turnOnPasswordChange === 1)) { |
|
226 | + if (!empty($ldapDefaultPPolicyDN) && ((int) $turnOnPasswordChange === 1)) { |
|
227 | 227 | //remove last password expiry warning if any |
228 | 228 | $notification = $this->notificationManager->createNotification(); |
229 | 229 | $notification->setApp('user_ldap') |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | $filter = $this->access->combineFilterWithAnd([ |
265 | 265 | $this->access->connection->ldapUserFilter, |
266 | - $this->access->connection->ldapUserDisplayName . '=*', |
|
266 | + $this->access->connection->ldapUserDisplayName.'=*', |
|
267 | 267 | $this->access->getFilterPartForUserSearch($search) |
268 | 268 | ]); |
269 | 269 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $this->access->userManager->getAttributes(true), |
277 | 277 | $limit, $offset); |
278 | 278 | $ldap_users = $this->access->nextcloudUserNames($ldap_users); |
279 | - Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', ILogger::DEBUG); |
|
279 | + Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users).' Users found', ILogger::DEBUG); |
|
280 | 280 | |
281 | 281 | $this->access->connection->writeToCache($cachekey, $ldap_users); |
282 | 282 | return $ldap_users; |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | $uid = $user instanceof User ? $user->getUsername() : $user->getOCName(); |
302 | - $cacheKey = 'userExistsOnLDAP' . $uid; |
|
302 | + $cacheKey = 'userExistsOnLDAP'.$uid; |
|
303 | 303 | $userExists = $this->access->connection->getFromCache($cacheKey); |
304 | 304 | if (!is_null($userExists)) { |
305 | - return (bool)$userExists; |
|
305 | + return (bool) $userExists; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | $dn = $user->getDN(); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | public function userExists($uid) { |
349 | 349 | $userExists = $this->access->connection->getFromCache('userExists'.$uid); |
350 | 350 | if (!is_null($userExists)) { |
351 | - return (bool)$userExists; |
|
351 | + return (bool) $userExists; |
|
352 | 352 | } |
353 | 353 | //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking. |
354 | 354 | $user = $this->access->userManager->get($uid); |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | } |
380 | 380 | |
381 | 381 | $marked = $this->ocConfig->getUserValue($uid, 'user_ldap', 'isDeleted', 0); |
382 | - if ((int)$marked === 0) { |
|
382 | + if ((int) $marked === 0) { |
|
383 | 383 | \OC::$server->getLogger()->notice( |
384 | - 'User '.$uid . ' is not marked as deleted, not cleaning up.', |
|
384 | + 'User '.$uid.' is not marked as deleted, not cleaning up.', |
|
385 | 385 | ['app' => 'user_ldap']); |
386 | 386 | return false; |
387 | 387 | } |
388 | - \OC::$server->getLogger()->info('Cleaning up after user ' . $uid, |
|
388 | + \OC::$server->getLogger()->info('Cleaning up after user '.$uid, |
|
389 | 389 | ['app' => 'user_ldap']); |
390 | 390 | |
391 | 391 | $this->access->getUserMapper()->unmap($uid); // we don't emit unassign signals here, since it is implicit to delete signals fired from core |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | if ($user instanceof User || $user instanceof OfflineUser) { |
423 | 423 | $path = $user->getHomePath() ?: false; |
424 | 424 | } else { |
425 | - throw new NoUserException($uid . ' is not a valid user anymore'); |
|
425 | + throw new NoUserException($uid.' is not a valid user anymore'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | $this->access->cacheUserHome($uid, $path); |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | * compared with \OC\User\Backend::CREATE_USER etc. |
531 | 531 | */ |
532 | 532 | public function implementsActions($actions) { |
533 | - return (bool)((Backend::CHECK_PASSWORD |
|
533 | + return (bool) ((Backend::CHECK_PASSWORD |
|
534 | 534 | | Backend::GET_HOME |
535 | 535 | | Backend::GET_DISPLAYNAME |
536 | 536 | | (($this->access->connection->ldapUserAvatarRule !== 'none') ? Backend::PROVIDE_AVATAR : 0) |
537 | 537 | | Backend::COUNT_USERS |
538 | - | (((int)$this->access->connection->turnOnPasswordChange === 1)? Backend::SET_PASSWORD :0) |
|
538 | + | (((int) $this->access->connection->turnOnPasswordChange === 1) ? Backend::SET_PASSWORD : 0) |
|
539 | 539 | | $this->userPluginManager->getImplementedActions()) |
540 | 540 | & $actions); |
541 | 541 | } |
@@ -114,7 +114,7 @@ |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
117 | - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
117 | + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string) time()); |
|
118 | 118 | $this->deletedUsers = null; |
119 | 119 | } |
120 | 120 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $attributes = array_reduce($attributes, |
197 | - function ($list, $attribute) { |
|
198 | - $attribute = strtolower(trim((string)$attribute)); |
|
197 | + function($list, $attribute) { |
|
198 | + $attribute = strtolower(trim((string) $attribute)); |
|
199 | 199 | if (!empty($attribute) && !in_array($attribute, $list)) { |
200 | 200 | $list[] = $attribute; |
201 | 201 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function isDeletedUser($id) { |
217 | 217 | $isDeleted = $this->ocConfig->getUserValue( |
218 | 218 | $id, 'user_ldap', 'isDeleted', 0); |
219 | - return (int)$isDeleted === 1; |
|
219 | + return (int) $isDeleted === 1; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -292,7 +292,7 @@ |
||
292 | 292 | |
293 | 293 | $config = new Configuration($configID); |
294 | 294 | $data = $config->getConfiguration(); |
295 | - if (!(int)$showPassword) { |
|
295 | + if (!(int) $showPassword) { |
|
296 | 296 | $data['ldapAgentPassword'] = '***'; |
297 | 297 | } |
298 | 298 | foreach ($data as $key => $value) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function getMinPagingSize() { |
105 | 105 | $configKeys = $this->config->getAppKeys('user_ldap'); |
106 | - $configKeys = array_filter($configKeys, function ($key) { |
|
106 | + $configKeys = array_filter($configKeys, function($key) { |
|
107 | 107 | return strpos($key, 'ldap_paging_size') !== false; |
108 | 108 | }); |
109 | 109 | $minPagingSize = null; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $pagingSize = $this->config->getAppValue('user_ldap', $configKey, $minPagingSize); |
112 | 112 | $minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize); |
113 | 113 | } |
114 | - return (int)$minPagingSize; |
|
114 | + return (int) $minPagingSize; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $filter = $access->combineFilterWithAnd([ |
166 | 166 | $access->connection->ldapUserFilter, |
167 | - $access->connection->ldapUserDisplayName . '=*', |
|
167 | + $access->connection->ldapUserDisplayName.'=*', |
|
168 | 168 | $access->getFilterPartForUserSearch('') |
169 | 169 | ]); |
170 | 170 | $results = $access->fetchListOfUsers( |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | true |
176 | 176 | ); |
177 | 177 | |
178 | - if ((int)$connection->ldapPagingSize === 0) { |
|
178 | + if ((int) $connection->ldapPagingSize === 0) { |
|
179 | 179 | return false; |
180 | 180 | } |
181 | - return count($results) >= (int)$connection->ldapPagingSize; |
|
181 | + return count($results) >= (int) $connection->ldapPagingSize; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | $cycleData = [ |
197 | 197 | 'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null), |
198 | - 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
198 | + 'offset' => (int) $this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
199 | 199 | ]; |
200 | 200 | |
201 | 201 | if ( |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @return bool |
253 | 253 | */ |
254 | 254 | public function qualifiesToRun($cycleData) { |
255 | - $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0); |
|
255 | + $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'].'_lastChange', 0); |
|
256 | 256 | if ((time() - $lastChange) > 60 * 30) { |
257 | 257 | return true; |
258 | 258 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | protected function increaseOffset($cycleData) { |
268 | 268 | $ldapConfig = new Configuration($cycleData['prefix']); |
269 | - $cycleData['offset'] += (int)$ldapConfig->ldapPagingSize; |
|
269 | + $cycleData['offset'] += (int) $ldapConfig->ldapPagingSize; |
|
270 | 270 | $this->setCycle($cycleData); |
271 | 271 | } |
272 | 272 |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $offset += $batchSize; |
92 | 92 | } catch (\InvalidArgumentException $e) { |
93 | 93 | if (strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { |
94 | - $batchSize = (int)floor(count($records) * 0.8); |
|
94 | + $batchSize = (int) floor(count($records) * 0.8); |
|
95 | 95 | $retry = true; |
96 | 96 | } |
97 | 97 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $this->respondToActions |= $respondToActions; |
61 | 61 | |
62 | 62 | foreach ($this->which as $action => $v) { |
63 | - if (is_int($action) && (bool)($respondToActions & $action)) { |
|
63 | + if (is_int($action) && (bool) ($respondToActions & $action)) { |
|
64 | 64 | $this->which[$action] = $plugin; |
65 | 65 | \OC::$server->getLogger()->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); |
66 | 66 | } |
67 | 67 | } |
68 | - if (method_exists($plugin,'deleteUser')) { |
|
68 | + if (method_exists($plugin, 'deleteUser')) { |
|
69 | 69 | $this->which['deleteUser'] = $plugin; |
70 | 70 | \OC::$server->getLogger()->debug("Registered action deleteUser to plugin ".get_class($plugin), ['app' => 'user_ldap']); |
71 | 71 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $plugin = $this->which[Backend::CREATE_USER]; |
93 | 93 | |
94 | 94 | if ($plugin) { |
95 | - return $plugin->createUser($username,$password); |
|
95 | + return $plugin->createUser($username, $password); |
|
96 | 96 | } |
97 | 97 | throw new \Exception('No plugin implements createUser in this LDAP Backend.'); |
98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $plugin = $this->which[Backend::SET_PASSWORD]; |
109 | 109 | |
110 | 110 | if ($plugin) { |
111 | - return $plugin->setPassword($uid,$password); |
|
111 | + return $plugin->setPassword($uid, $password); |
|
112 | 112 | } |
113 | 113 | throw new \Exception('No plugin implements setPassword in this LDAP Backend.'); |
114 | 114 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | <?php endif; ?> |
25 | 25 | <div id="message" class="hidden"> |
26 | 26 | <img class="float-spinner" alt="" |
27 | - src="<?php p(image_path('core', 'loading-dark.gif'));?>"> |
|
27 | + src="<?php p(image_path('core', 'loading-dark.gif')); ?>"> |
|
28 | 28 | <span id="messageText"></span> |
29 | 29 | <!-- the following div ensures that the spinner is always inside the #message div --> |
30 | 30 | <div style="clear: both;"></div> |
31 | 31 | </div> |
32 | 32 | <p class="grouptop"> |
33 | 33 | <input type="password" id="oldPassword" name="oldPassword" |
34 | - placeholder="<?php echo $l->t('Current password');?>" |
|
34 | + placeholder="<?php echo $l->t('Current password'); ?>" |
|
35 | 35 | autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
36 | 36 | <label for="oldPassword" class="infield"><?php p($l->t('Current password')); ?></label> |
37 | 37 | </p> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | <input type="checkbox" id="personal-show" name="show" class="hidden-visually" /><label for="personal-show"></label> |
41 | 41 | <label id="newPassword-label" for="newPassword" class="infield"><?php p($l->t('New password')); ?></label> |
42 | 42 | <input type="password" id="newPassword" name="newPassword" |
43 | - placeholder="<?php echo $l->t('New password');?>" |
|
43 | + placeholder="<?php echo $l->t('New password'); ?>" |
|
44 | 44 | data-typetoggle="#personal-show" autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
45 | 45 | </p> |
46 | 46 |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | </select> |
15 | 15 | <button type="button" id="ldap_action_add_configuration" |
16 | 16 | name="ldap_action_add_configuration" class="icon-add icon-default-style" |
17 | - title="<?php p($l->t('Add a new configuration'));?>"> </button> |
|
17 | + title="<?php p($l->t('Add a new configuration')); ?>"> </button> |
|
18 | 18 | <button type="button" id="ldap_action_copy_configuration" |
19 | 19 | name="ldap_action_copy_configuration" |
20 | 20 | class="ldapIconCopy icon-default-style" |
21 | - title="<?php p($l->t('Copy current configuration into new directory binding'));?>"> </button> |
|
21 | + title="<?php p($l->t('Copy current configuration into new directory binding')); ?>"> </button> |
|
22 | 22 | <button type="button" id="ldap_action_delete_configuration" |
23 | 23 | name="ldap_action_delete_configuration" class="icon-delete icon-default-style" |
24 | - title="<?php p($l->t('Delete the current configuration'));?>"> </button> |
|
24 | + title="<?php p($l->t('Delete the current configuration')); ?>"> </button> |
|
25 | 25 | </p> |
26 | 26 | |
27 | 27 | <div class="hostPortCombinator"> |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | <div class="table"> |
31 | 31 | <input type="text" class="host" id="ldap_host" |
32 | 32 | name="ldap_host" |
33 | - placeholder="<?php p($l->t('Host'));?>" |
|
34 | - title="<?php p($l->t('You can omit the protocol, unless you require SSL. If so, start with ldaps://'));?>" |
|
33 | + placeholder="<?php p($l->t('Host')); ?>" |
|
34 | + title="<?php p($l->t('You can omit the protocol, unless you require SSL. If so, start with ldaps://')); ?>" |
|
35 | 35 | /> |
36 | 36 | <span class="hostPortCombinatorSpan"> |
37 | 37 | <input type="number" id="ldap_port" name="ldap_port" |
38 | - placeholder="<?php p($l->t('Port'));?>" /> |
|
38 | + placeholder="<?php p($l->t('Port')); ?>" /> |
|
39 | 39 | <button class="ldapDetectPort" name="ldapDetectPort" type="button"> |
40 | - <?php p($l->t('Detect Port'));?> |
|
40 | + <?php p($l->t('Detect Port')); ?> |
|
41 | 41 | </button> |
42 | 42 | </span> |
43 | 43 | </div> |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | <div class="tablerow"> |
48 | 48 | <input type="text" id="ldap_dn" name="ldap_dn" |
49 | 49 | class="tablecell" |
50 | - placeholder="<?php p($l->t('User DN'));?>" autocomplete="off" |
|
51 | - title="<?php p($l->t('The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty.'));?>" |
|
50 | + placeholder="<?php p($l->t('User DN')); ?>" autocomplete="off" |
|
51 | + title="<?php p($l->t('The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty.')); ?>" |
|
52 | 52 | /> |
53 | 53 | </div> |
54 | 54 | |
55 | 55 | <div class="tablerow"> |
56 | 56 | <input type="password" id="ldap_agent_password" |
57 | 57 | class="tablecell" name="ldap_agent_password" |
58 | - placeholder="<?php p($l->t('Password'));?>" autocomplete="off" |
|
59 | - title="<?php p($l->t('For anonymous access, leave DN and Password empty.'));?>" |
|
58 | + placeholder="<?php p($l->t('Password')); ?>" autocomplete="off" |
|
59 | + title="<?php p($l->t('For anonymous access, leave DN and Password empty.')); ?>" |
|
60 | 60 | /> |
61 | 61 | <button class="ldapSaveAgentCredentials" name="ldapSaveAgentCredentials" type="button"> |
62 | - <?php p($l->t('Save Credentials'));?> |
|
62 | + <?php p($l->t('Save Credentials')); ?> |
|
63 | 63 | </button> |
64 | 64 | </div> |
65 | 65 | <div class="tablerow"> </div> |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | <div class="tablerow"> |
68 | 68 | <textarea id="ldap_base" name="ldap_base" |
69 | 69 | class="tablecell" |
70 | - placeholder="<?php p($l->t('One Base DN per line'));?>" |
|
71 | - title="<?php p($l->t('You can specify Base DN for users and groups in the Advanced tab'));?>"> |
|
70 | + placeholder="<?php p($l->t('One Base DN per line')); ?>" |
|
71 | + title="<?php p($l->t('You can specify Base DN for users and groups in the Advanced tab')); ?>"> |
|
72 | 72 | </textarea> |
73 | 73 | <button class="ldapDetectBase" name="ldapDetectBase" type="button"> |
74 | - <?php p($l->t('Detect Base DN'));?> |
|
74 | + <?php p($l->t('Detect Base DN')); ?> |
|
75 | 75 | </button> |
76 | 76 | <button class="ldapTestBase" name="ldapTestBase" type="button"> |
77 | - <?php p($l->t('Test Base DN'));?> |
|
77 | + <?php p($l->t('Test Base DN')); ?> |
|
78 | 78 | </button> |
79 | 79 | </div> |
80 | 80 | |
81 | 81 | <div class="tablerow left"> |
82 | 82 | <input type="checkbox" id="ldap_experienced_admin" value="1" |
83 | 83 | name="ldap_experienced_admin" class="tablecell" |
84 | - title="<?php p($l->t('Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge.'));?>" |
|
84 | + title="<?php p($l->t('Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge.')); ?>" |
|
85 | 85 | /> |
86 | 86 | <label for="ldap_experienced_admin" class="tablecell"> |
87 | - <?php p($l->t('Manually enter LDAP filters (recommended for large directories)'));?> |
|
87 | + <?php p($l->t('Manually enter LDAP filters (recommended for large directories)')); ?> |
|
88 | 88 | </label> |
89 | 89 | </div> |
90 | 90 |