@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | <div class="warning title"> |
| 19 | 19 | <?php p($l->t('Please renew your password.')); ?><br> |
| 20 | 20 | </div> |
| 21 | - <?php foreach($_['messages'] as $message): ?> |
|
| 21 | + <?php foreach ($_['messages'] as $message): ?> |
|
| 22 | 22 | <div class="warning"> |
| 23 | 23 | <?php p($message); ?><br> |
| 24 | 24 | </div> |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | <?php endif; ?> |
| 32 | 32 | <div id="message" class="hidden"> |
| 33 | 33 | <img class="float-spinner" alt="" |
| 34 | - src="<?php p(image_path('core', 'loading-dark.gif'));?>"> |
|
| 34 | + src="<?php p(image_path('core', 'loading-dark.gif')); ?>"> |
|
| 35 | 35 | <span id="messageText"></span> |
| 36 | 36 | <!-- the following div ensures that the spinner is always inside the #message div --> |
| 37 | 37 | <div style="clear: both;"></div> |
| 38 | 38 | </div> |
| 39 | 39 | <p class="grouptop"> |
| 40 | 40 | <input type="password" id="oldPassword" name="oldPassword" |
| 41 | - placeholder="<?php echo $l->t('Current password');?>" |
|
| 41 | + placeholder="<?php echo $l->t('Current password'); ?>" |
|
| 42 | 42 | autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
| 43 | 43 | <label for="oldPassword" class="infield"><?php p($l->t('Current password')); ?></label> |
| 44 | 44 | </p> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | <input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label> |
| 48 | 48 | <label id="newPassword-label" for="newPassword" class="infield"><?php p($l->t('New password')); ?></label> |
| 49 | 49 | <input type="password" id="newPassword" name="newPassword" |
| 50 | - placeholder="<?php echo $l->t('New password');?>" |
|
| 50 | + placeholder="<?php echo $l->t('New password'); ?>" |
|
| 51 | 51 | data-typetoggle="#personal-show" autofocus autocomplete="off" autocapitalize="off" autocorrect="off" required/> |
| 52 | 52 | </p> |
| 53 | 53 | |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | //pass in app.php we do add here, except something else is passed e.g. |
| 81 | 81 | //in tests. |
| 82 | 82 | |
| 83 | - if(isset($arguments['helper'])) { |
|
| 83 | + if (isset($arguments['helper'])) { |
|
| 84 | 84 | $this->ldapHelper = $arguments['helper']; |
| 85 | 85 | } else { |
| 86 | 86 | $this->ldapHelper = new Helper(\OC::$server->getConfig()); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(isset($arguments['ocConfig'])) { |
|
| 89 | + if (isset($arguments['ocConfig'])) { |
|
| 90 | 90 | $this->ocConfig = $arguments['ocConfig']; |
| 91 | 91 | } else { |
| 92 | 92 | $this->ocConfig = \OC::$server->getConfig(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if(isset($arguments['userBackend'])) { |
|
| 95 | + if (isset($arguments['userBackend'])) { |
|
| 96 | 96 | $this->userBackend = $arguments['userBackend']; |
| 97 | 97 | } else { |
| 98 | - $this->userBackend = new User_Proxy( |
|
| 98 | + $this->userBackend = new User_Proxy( |
|
| 99 | 99 | $this->ldapHelper->getServerConfigurationPrefixes(true), |
| 100 | 100 | new LDAP(), |
| 101 | 101 | $this->ocConfig, |
@@ -103,19 +103,19 @@ discard block |
||
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if(isset($arguments['db'])) { |
|
| 106 | + if (isset($arguments['db'])) { |
|
| 107 | 107 | $this->db = $arguments['db']; |
| 108 | 108 | } else { |
| 109 | 109 | $this->db = \OC::$server->getDatabaseConnection(); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if(isset($arguments['mapping'])) { |
|
| 112 | + if (isset($arguments['mapping'])) { |
|
| 113 | 113 | $this->mapping = $arguments['mapping']; |
| 114 | 114 | } else { |
| 115 | 115 | $this->mapping = new UserMapping($this->db); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if(isset($arguments['deletedUsersIndex'])) { |
|
| 118 | + if (isset($arguments['deletedUsersIndex'])) { |
|
| 119 | 119 | $this->dui = $arguments['deletedUsersIndex']; |
| 120 | 120 | } else { |
| 121 | 121 | $this->dui = new DeletedUsersIndex( |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | public function run($argument) { |
| 131 | 131 | $this->setArguments($argument); |
| 132 | 132 | |
| 133 | - if(!$this->isCleanUpAllowed()) { |
|
| 133 | + if (!$this->isCleanUpAllowed()) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | $users = $this->mapping->getList($this->getOffset(), $this->limit); |
| 137 | - if(!is_array($users)) { |
|
| 137 | + if (!is_array($users)) { |
|
| 138 | 138 | //something wrong? Let's start from the beginning next time and |
| 139 | 139 | //abort |
| 140 | 140 | $this->setOffset(true); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function isCleanUpAllowed() { |
| 162 | 162 | try { |
| 163 | - if($this->ldapHelper->haveDisabledConfigurations()) { |
|
| 163 | + if ($this->ldapHelper->haveDisabledConfigurations()) { |
|
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | } catch (\Exception $e) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @return bool |
| 178 | 178 | */ |
| 179 | 179 | private function isCleanUpEnabled() { |
| 180 | - return (bool)$this->ocConfig->getSystemValue( |
|
| 180 | + return (bool) $this->ocConfig->getSystemValue( |
|
| 181 | 181 | 'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param array $users result from getMappedUsers() |
| 187 | 187 | */ |
| 188 | 188 | private function checkUsers(array $users) { |
| 189 | - foreach($users as $user) { |
|
| 189 | + foreach ($users as $user) { |
|
| 190 | 190 | $this->checkUser($user); |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param string[] $user |
| 197 | 197 | */ |
| 198 | 198 | private function checkUser(array $user) { |
| 199 | - if($this->userBackend->userExistsOnLDAP($user['name'])) { |
|
| 199 | + if ($this->userBackend->userExistsOnLDAP($user['name'])) { |
|
| 200 | 200 | //still available, all good |
| 201 | 201 | |
| 202 | 202 | return; |
@@ -218,8 +218,7 @@ discard block |
||
| 218 | 218 | * @param bool $reset whether the offset should be set to 0 |
| 219 | 219 | */ |
| 220 | 220 | public function setOffset($reset = false) { |
| 221 | - $newOffset = $reset ? 0 : |
|
| 222 | - $this->getOffset() + $this->limit; |
|
| 221 | + $newOffset = $reset ? 0 : $this->getOffset() + $this->limit; |
|
| 223 | 222 | $this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', $newOffset); |
| 224 | 223 | } |
| 225 | 224 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | use OCP\AppFramework\IAppContainer; |
| 28 | 28 | |
| 29 | 29 | class Application extends App { |
| 30 | - public function __construct () { |
|
| 30 | + public function __construct() { |
|
| 31 | 31 | parent::__construct('user_ldap'); |
| 32 | 32 | $container = $this->getContainer(); |
| 33 | 33 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $keys = $this->getServersConfig($referenceConfigkey); |
| 97 | 97 | |
| 98 | 98 | $result = array(); |
| 99 | - foreach($keys as $key) { |
|
| 99 | + foreach ($keys as $key) { |
|
| 100 | 100 | $len = strlen($key) - strlen($referenceConfigkey); |
| 101 | 101 | $prefix = substr($key, 0, $len); |
| 102 | 102 | $result[$prefix] = $this->config->getAppValue('user_ldap', $key); |
@@ -113,19 +113,19 @@ discard block |
||
| 113 | 113 | public function getNextServerConfigurationPrefix() { |
| 114 | 114 | $serverConnections = $this->getServerConfigurationPrefixes(); |
| 115 | 115 | |
| 116 | - if(count($serverConnections) === 0) { |
|
| 116 | + if (count($serverConnections) === 0) { |
|
| 117 | 117 | return 's01'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | sort($serverConnections); |
| 121 | 121 | $lastKey = array_pop($serverConnections); |
| 122 | 122 | $lastNumber = intval(str_replace('s', '', $lastKey)); |
| 123 | - $nextPrefix = 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
| 123 | + $nextPrefix = 's'.str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); |
|
| 124 | 124 | return $nextPrefix; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | private function getServersConfig($value) { |
| 128 | - $regex = '/' . $value . '$/S'; |
|
| 128 | + $regex = '/'.$value.'$/S'; |
|
| 129 | 129 | |
| 130 | 130 | $keys = $this->config->getAppKeys('user_ldap'); |
| 131 | 131 | $result = []; |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | * @return bool true on success, false otherwise |
| 145 | 145 | */ |
| 146 | 146 | public function deleteServerConfiguration($prefix) { |
| 147 | - if(!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
| 147 | + if (!in_array($prefix, self::getServerConfigurationPrefixes())) { |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $saveOtherConfigurations = ''; |
| 152 | - if(empty($prefix)) { |
|
| 152 | + if (empty($prefix)) { |
|
| 153 | 153 | $saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\''; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | '); |
| 164 | 164 | $delRows = $query->execute(array($prefix.'%')); |
| 165 | 165 | |
| 166 | - if(\OCP\DB::isError($delRows)) { |
|
| 166 | + if (\OCP\DB::isError($delRows)) { |
|
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if($delRows === 0) { |
|
| 170 | + if ($delRows === 0) { |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $all = $this->getServerConfigurationPrefixes(false); |
| 184 | 184 | $active = $this->getServerConfigurationPrefixes(true); |
| 185 | 185 | |
| 186 | - if(!is_array($all) || !is_array($active)) { |
|
| 186 | + if (!is_array($all) || !is_array($active)) { |
|
| 187 | 187 | throw new \Exception('Unexpected Return Value'); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function getDomainFromURL($url) { |
| 199 | 199 | $uinfo = parse_url($url); |
| 200 | - if(!is_array($uinfo)) { |
|
| 200 | + if (!is_array($uinfo)) { |
|
| 201 | 201 | return false; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $domain = false; |
| 205 | - if(isset($uinfo['host'])) { |
|
| 205 | + if (isset($uinfo['host'])) { |
|
| 206 | 206 | $domain = $uinfo['host']; |
| 207 | - } else if(isset($uinfo['path'])) { |
|
| 207 | + } else if (isset($uinfo['path'])) { |
|
| 208 | 208 | $domain = $uinfo['path']; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function setLDAPProvider() { |
| 220 | 220 | $current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null); |
| 221 | - if(is_null($current)) { |
|
| 221 | + if (is_null($current)) { |
|
| 222 | 222 | \OC::$server->getConfig()->setSystemValue('ldapProviderFactory', '\\OCA\\User_LDAP\\LDAPProviderFactory'); |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function sanitizeDN($dn) { |
| 232 | 232 | //treating multiple base DNs |
| 233 | - if(is_array($dn)) { |
|
| 233 | + if (is_array($dn)) { |
|
| 234 | 234 | $result = array(); |
| 235 | - foreach($dn as $singleDN) { |
|
| 235 | + foreach ($dn as $singleDN) { |
|
| 236 | 236 | $result[] = $this->sanitizeDN($singleDN); |
| 237 | 237 | } |
| 238 | 238 | return $result; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * @throws \Exception |
| 284 | 284 | */ |
| 285 | 285 | public static function loginName2UserName($param) { |
| 286 | - if(!isset($param['uid'])) { |
|
| 286 | + if (!isset($param['uid'])) { |
|
| 287 | 287 | throw new \Exception('key uid is expected to be set in $param'); |
| 288 | 288 | } |
| 289 | 289 | |
@@ -295,11 +295,11 @@ discard block |
||
| 295 | 295 | $ocConfig = \OC::$server->getConfig(); |
| 296 | 296 | $notificationManager = \OC::$server->getNotificationManager(); |
| 297 | 297 | |
| 298 | - $userBackend = new User_Proxy( |
|
| 298 | + $userBackend = new User_Proxy( |
|
| 299 | 299 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager |
| 300 | 300 | ); |
| 301 | - $uid = $userBackend->loginName2UserName($param['uid'] ); |
|
| 302 | - if($uid !== false) { |
|
| 301 | + $uid = $userBackend->loginName2UserName($param['uid']); |
|
| 302 | + if ($uid !== false) { |
|
| 303 | 303 | $param['uid'] = $uid; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | public function __construct(array $serverConfigPrefixes, ILDAPWrapper $ldap, IConfig $ocConfig, |
| 45 | 45 | INotificationManager $notificationManager) { |
| 46 | 46 | parent::__construct($ldap); |
| 47 | - foreach($serverConfigPrefixes as $configPrefix) { |
|
| 47 | + foreach ($serverConfigPrefixes as $configPrefix) { |
|
| 48 | 48 | $this->backends[$configPrefix] = |
| 49 | 49 | new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager); |
| 50 | - if(is_null($this->refBackend)) { |
|
| 50 | + if (is_null($this->refBackend)) { |
|
| 51 | 51 | $this->refBackend = &$this->backends[$configPrefix]; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function walkBackends($uid, $method, $parameters) { |
| 64 | 64 | $cacheKey = $this->getUserCacheKey($uid); |
| 65 | - foreach($this->backends as $configPrefix => $backend) { |
|
| 65 | + foreach ($this->backends as $configPrefix => $backend) { |
|
| 66 | 66 | $instance = $backend; |
| 67 | - if(!method_exists($instance, $method) |
|
| 67 | + if (!method_exists($instance, $method) |
|
| 68 | 68 | && method_exists($this->getAccess($configPrefix), $method)) { |
| 69 | 69 | $instance = $this->getAccess($configPrefix); |
| 70 | 70 | } |
| 71 | - if($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
| 71 | + if ($result = call_user_func_array(array($instance, $method), $parameters)) { |
|
| 72 | 72 | $this->writeToCache($cacheKey, $configPrefix); |
| 73 | 73 | return $result; |
| 74 | 74 | } |
@@ -88,22 +88,22 @@ discard block |
||
| 88 | 88 | $cacheKey = $this->getUserCacheKey($uid); |
| 89 | 89 | $prefix = $this->getFromCache($cacheKey); |
| 90 | 90 | //in case the uid has been found in the past, try this stored connection first |
| 91 | - if(!is_null($prefix)) { |
|
| 92 | - if(isset($this->backends[$prefix])) { |
|
| 91 | + if (!is_null($prefix)) { |
|
| 92 | + if (isset($this->backends[$prefix])) { |
|
| 93 | 93 | $instance = $this->backends[$prefix]; |
| 94 | - if(!method_exists($instance, $method) |
|
| 94 | + if (!method_exists($instance, $method) |
|
| 95 | 95 | && method_exists($this->getAccess($prefix), $method)) { |
| 96 | 96 | $instance = $this->getAccess($prefix); |
| 97 | 97 | } |
| 98 | 98 | $result = call_user_func_array(array($instance, $method), $parameters); |
| 99 | - if($result === $passOnWhen) { |
|
| 99 | + if ($result === $passOnWhen) { |
|
| 100 | 100 | //not found here, reset cache to null if user vanished |
| 101 | 101 | //because sometimes methods return false with a reason |
| 102 | 102 | $userExists = call_user_func_array( |
| 103 | 103 | array($this->backends[$prefix], 'userExists'), |
| 104 | 104 | array($uid) |
| 105 | 105 | ); |
| 106 | - if(!$userExists) { |
|
| 106 | + if (!$userExists) { |
|
| 107 | 107 | $this->writeToCache($cacheKey, null); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function getUsers($search = '', $limit = 10, $offset = 0) { |
| 146 | 146 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
| 147 | 147 | $users = array(); |
| 148 | - foreach($this->backends as $backend) { |
|
| 148 | + foreach ($this->backends as $backend) { |
|
| 149 | 149 | $backendUsers = $backend->getUsers($search, $limit, $offset); |
| 150 | 150 | if (is_array($backendUsers)) { |
| 151 | 151 | $users = array_merge($users, $backendUsers); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @return string|false |
| 194 | 194 | */ |
| 195 | 195 | public function loginName2UserName($loginName) { |
| 196 | - $id = 'LOGINNAME,' . $loginName; |
|
| 196 | + $id = 'LOGINNAME,'.$loginName; |
|
| 197 | 197 | return $this->handleRequest($id, 'loginName2UserName', array($loginName)); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return string|false with the username |
| 205 | 205 | */ |
| 206 | 206 | public function dn2UserName($dn) { |
| 207 | - $id = 'DN,' . $dn; |
|
| 207 | + $id = 'DN,'.$dn; |
|
| 208 | 208 | return $this->handleRequest($id, 'dn2UserName', array($dn)); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | public function getDisplayNames($search = '', $limit = null, $offset = null) { |
| 246 | 246 | //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends |
| 247 | 247 | $users = array(); |
| 248 | - foreach($this->backends as $backend) { |
|
| 248 | + foreach ($this->backends as $backend) { |
|
| 249 | 249 | $backendUsers = $backend->getDisplayNames($search, $limit, $offset); |
| 250 | 250 | if (is_array($backendUsers)) { |
| 251 | 251 | $users = $users + $backendUsers; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function countUsers() { |
| 291 | 291 | $users = false; |
| 292 | - foreach($this->backends as $backend) { |
|
| 292 | + foreach ($this->backends as $backend) { |
|
| 293 | 293 | $backendUsers = $backend->countUsers(); |
| 294 | 294 | if ($backendUsers !== false) { |
| 295 | 295 | $users += $backendUsers; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function __construct(ILDAPWrapper $ldap) { |
| 48 | 48 | $this->ldap = $ldap; |
| 49 | 49 | $memcache = \OC::$server->getMemCacheFactory(); |
| 50 | - if($memcache->isAvailable()) { |
|
| 50 | + if ($memcache->isAvailable()) { |
|
| 51 | 51 | $this->cache = $memcache->create(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | static $db; |
| 66 | 66 | static $coreUserManager; |
| 67 | 67 | static $coreNotificationManager; |
| 68 | - if(is_null($fs)) { |
|
| 68 | + if (is_null($fs)) { |
|
| 69 | 69 | $ocConfig = \OC::$server->getConfig(); |
| 70 | 70 | $fs = new FilesystemHelper(); |
| 71 | 71 | $log = new LogWrapper(); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return mixed |
| 92 | 92 | */ |
| 93 | 93 | protected function getAccess($configPrefix) { |
| 94 | - if(!isset(self::$accesses[$configPrefix])) { |
|
| 94 | + if (!isset(self::$accesses[$configPrefix])) { |
|
| 95 | 95 | $this->addAccess($configPrefix); |
| 96 | 96 | } |
| 97 | 97 | return self::$accesses[$configPrefix]; |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | * @return mixed, the result of the specified method |
| 146 | 146 | */ |
| 147 | 147 | protected function handleRequest($id, $method, $parameters, $passOnWhen = false) { |
| 148 | - $result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen); |
|
| 149 | - if($result === $passOnWhen) { |
|
| 148 | + $result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen); |
|
| 149 | + if ($result === $passOnWhen) { |
|
| 150 | 150 | $result = $this->walkBackends($id, $method, $parameters); |
| 151 | 151 | } |
| 152 | 152 | return $result; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | private function getCacheKey($key) { |
| 160 | 160 | $prefix = 'LDAP-Proxy-'; |
| 161 | - if(is_null($key)) { |
|
| 161 | + if (is_null($key)) { |
|
| 162 | 162 | return $prefix; |
| 163 | 163 | } |
| 164 | 164 | return $prefix.md5($key); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @return mixed|null |
| 170 | 170 | */ |
| 171 | 171 | public function getFromCache($key) { |
| 172 | - if(is_null($this->cache) || !$this->isCached($key)) { |
|
| 172 | + if (is_null($this->cache) || !$this->isCached($key)) { |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | $key = $this->getCacheKey($key); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return bool |
| 183 | 183 | */ |
| 184 | 184 | public function isCached($key) { |
| 185 | - if(is_null($this->cache)) { |
|
| 185 | + if (is_null($this->cache)) { |
|
| 186 | 186 | return false; |
| 187 | 187 | } |
| 188 | 188 | $key = $this->getCacheKey($key); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param mixed $value |
| 195 | 195 | */ |
| 196 | 196 | public function writeToCache($key, $value) { |
| 197 | - if(is_null($this->cache)) { |
|
| 197 | + if (is_null($this->cache)) { |
|
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | $key = $this->getCacheKey($key); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | public function clearCache() { |
| 206 | - if(is_null($this->cache)) { |
|
| 206 | + if (is_null($this->cache)) { |
|
| 207 | 207 | return; |
| 208 | 208 | } |
| 209 | 209 | $this->cache->clear($this->getCacheKey(null)); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'name' => $l->t('LDAP user and group backend'), |
| 44 | 44 | ]; |
| 45 | 45 | }); |
| 46 | -if(count($configPrefixes) === 1) { |
|
| 46 | +if (count($configPrefixes) === 1) { |
|
| 47 | 47 | $dbc = \OC::$server->getDatabaseConnection(); |
| 48 | 48 | $userManager = new OCA\User_LDAP\User\Manager($ocConfig, |
| 49 | 49 | new OCA\User_LDAP\FilesystemHelper(), |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); |
| 62 | 62 | $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig, $notificationManager); |
| 63 | 63 | $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); |
| 64 | -} else if(count($configPrefixes) > 1) { |
|
| 64 | +} else if (count($configPrefixes) > 1) { |
|
| 65 | 65 | $userBackend = new OCA\User_LDAP\User_Proxy( |
| 66 | 66 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager |
| 67 | 67 | ); |
| 68 | - $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 68 | + $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -if(count($configPrefixes) > 0) { |
|
| 71 | +if (count($configPrefixes) > 0) { |
|
| 72 | 72 | // register user backend |
| 73 | 73 | OC_User::useBackend($userBackend); |
| 74 | 74 | \OC::$server->getGroupManager()->addBackend($groupBackend); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | 'loginName2UserName' |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | -if(OCP\App::isEnabled('user_webdavauth')) { |
|
| 84 | +if (OCP\App::isEnabled('user_webdavauth')) { |
|
| 85 | 85 | OCP\Util::writeLog('user_ldap', |
| 86 | 86 | 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', |
| 87 | 87 | OCP\Util::WARN); |
@@ -59,73 +59,73 @@ |
||
| 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 | - <?php if(OCP\App::isEnabled('user_webdavauth')) { |
|
| 69 | + <?php if (OCP\App::isEnabled('user_webdavauth')) { |
|
| 70 | 70 | print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them.').'</p>'); |
| 71 | 71 | } |
| 72 | - if(!function_exists('ldap_connect')) { |
|
| 72 | + if (!function_exists('ldap_connect')) { |
|
| 73 | 73 | 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>'); |
| 74 | 74 | } |
| 75 | 75 | ?> |
| 76 | - <?php require_once(__DIR__ . '/part.wizard-server.php'); ?> |
|
| 77 | - <?php require_once(__DIR__ . '/part.wizard-userfilter.php'); ?> |
|
| 78 | - <?php require_once(__DIR__ . '/part.wizard-loginfilter.php'); ?> |
|
| 79 | - <?php require_once(__DIR__ . '/part.wizard-groupfilter.php'); ?> |
|
| 76 | + <?php require_once(__DIR__.'/part.wizard-server.php'); ?> |
|
| 77 | + <?php require_once(__DIR__.'/part.wizard-userfilter.php'); ?> |
|
| 78 | + <?php require_once(__DIR__.'/part.wizard-loginfilter.php'); ?> |
|
| 79 | + <?php require_once(__DIR__.'/part.wizard-groupfilter.php'); ?> |
|
| 80 | 80 | <fieldset id="ldapSettings-1"> |
| 81 | 81 | <div id="ldapAdvancedAccordion"> |
| 82 | - <h3><?php p($l->t('Connection Settings'));?></h3> |
|
| 82 | + <h3><?php p($l->t('Connection Settings')); ?></h3> |
|
| 83 | 83 | <div> |
| 84 | - <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> |
|
| 85 | - <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> |
|
| 86 | - <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> |
|
| 87 | - <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> |
|
| 88 | - <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> |
|
| 89 | - <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> |
|
| 84 | + <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> |
|
| 85 | + <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> |
|
| 86 | + <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> |
|
| 87 | + <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> |
|
| 88 | + <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> |
|
| 89 | + <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> |
|
| 90 | 90 | </div> |
| 91 | - <h3><?php p($l->t('Directory Settings'));?></h3> |
|
| 91 | + <h3><?php p($l->t('Directory Settings')); ?></h3> |
|
| 92 | 92 | <div> |
| 93 | - <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> |
|
| 94 | - <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> |
|
| 95 | - <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> |
|
| 96 | - <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> |
|
| 97 | - <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> |
|
| 98 | - <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> |
|
| 99 | - <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> |
|
| 100 | - <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')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'member')) p(' selected'); ?>>member (AD)</option></select></p> |
|
| 101 | - <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> |
|
| 102 | - <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> |
|
| 103 | - <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> |
|
| 104 | - <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> |
|
| 93 | + <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> |
|
| 94 | + <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> |
|
| 95 | + <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> |
|
| 96 | + <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> |
|
| 97 | + <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> |
|
| 98 | + <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> |
|
| 99 | + <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> |
|
| 100 | + <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')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'member')) p(' selected'); ?>>member (AD)</option></select></p> |
|
| 101 | + <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> |
|
| 102 | + <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> |
|
| 103 | + <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> |
|
| 104 | + <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> |
|
| 105 | 105 | </span><br/></p> |
| 106 | - <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> |
|
| 106 | + <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> |
|
| 107 | 107 | </div> |
| 108 | - <h3><?php p($l->t('Special Attributes'));?></h3> |
|
| 108 | + <h3><?php p($l->t('Special Attributes')); ?></h3> |
|
| 109 | 109 | <div> |
| 110 | - <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> |
|
| 111 | - <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> |
|
| 112 | - <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> |
|
| 113 | - <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 user name (default). Otherwise, specify an LDAP/AD attribute.'));?>" data-default="<?php p($_['home_folder_naming_rule_default']); ?>" /></p> |
|
| 110 | + <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> |
|
| 111 | + <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> |
|
| 112 | + <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> |
|
| 113 | + <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 user name (default). Otherwise, specify an LDAP/AD attribute.')); ?>" data-default="<?php p($_['home_folder_naming_rule_default']); ?>" /></p> |
|
| 114 | 114 | </div> |
| 115 | 115 | </div> |
| 116 | 116 | <?php print_unescaped($_['settingControls']); ?> |
| 117 | 117 | </fieldset> |
| 118 | 118 | <fieldset id="ldapSettings-2"> |
| 119 | - <p><strong><?php p($l->t('Internal Username'));?></strong></p> |
|
| 120 | - <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> |
|
| 121 | - <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> |
|
| 122 | - <p><strong><?php p($l->t('Override UUID detection'));?></strong></p> |
|
| 123 | - <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> |
|
| 124 | - <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> |
|
| 125 | - <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> |
|
| 126 | - <p><strong><?php p($l->t('Username-LDAP User Mapping'));?></strong></p> |
|
| 127 | - <p class="ldapIndent"><?php p($l->t('Usernames are used to store and assign (meta) data. 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> |
|
| 128 | - <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> |
|
| 119 | + <p><strong><?php p($l->t('Internal Username')); ?></strong></p> |
|
| 120 | + <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> |
|
| 121 | + <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> |
|
| 122 | + <p><strong><?php p($l->t('Override UUID detection')); ?></strong></p> |
|
| 123 | + <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> |
|
| 124 | + <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> |
|
| 125 | + <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> |
|
| 126 | + <p><strong><?php p($l->t('Username-LDAP User Mapping')); ?></strong></p> |
|
| 127 | + <p class="ldapIndent"><?php p($l->t('Usernames are used to store and assign (meta) data. 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> |
|
| 128 | + <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> |
|
| 129 | 129 | <?php print_unescaped($_['settingControls']); ?> |
| 130 | 130 | </fieldset> |
| 131 | 131 | </div> |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @return TemplateResponse|RedirectResponse |
| 86 | 86 | */ |
| 87 | 87 | public function showRenewPasswordForm($user) { |
| 88 | - if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
| 88 | + if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
| 89 | 89 | return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); |
| 90 | 90 | } |
| 91 | 91 | $parameters = []; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return RedirectResponse |
| 130 | 130 | */ |
| 131 | 131 | public function tryRenewPassword($user, $oldPassword, $newPassword) { |
| 132 | - if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
| 132 | + if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') { |
|
| 133 | 133 | return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); |
| 134 | 134 | } |
| 135 | 135 | $args = !is_null($user) ? ['user' => $user] : []; |