Passed
Push — master ( b25838...0d6e9a )
by Blizzz
13:47 queued 11s
created
apps/user_ldap/lib/LDAPProvider.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->deletedUsersIndex = $deletedUsersIndex;
57 57
 		$userBackendFound = false;
58 58
 		$groupBackendFound = false;
59
-		foreach ($serverContainer->getUserManager()->getBackends() as $backend){
59
+		foreach ($serverContainer->getUserManager()->getBackends() as $backend) {
60 60
 			$this->logger->debug('instance '.get_class($backend).' user backend.', ['app' => 'user_ldap']);
61 61
 			if ($backend instanceof IUserLDAP) {
62 62
 				$this->userBackend = $backend;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				break;
65 65
 			}
66 66
         }
67
-		foreach ($serverContainer->getGroupManager()->getBackends() as $backend){
67
+		foreach ($serverContainer->getGroupManager()->getBackends() as $backend) {
68 68
 			$this->logger->debug('instance '.get_class($backend).' group backend.', ['app' => 'user_ldap']);
69 69
 			if ($backend instanceof IGroupLDAP) {
70 70
 				$this->groupBackend = $backend;
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 	 * @throws \Exception if translation was unsuccessful
86 86
 	 */
87 87
 	public function getUserDN($uid) {
88
-		if(!$this->userBackend->userExists($uid)){
88
+		if (!$this->userBackend->userExists($uid)) {
89 89
 			throw new \Exception('User id not found in LDAP');
90 90
 		}
91 91
 		$result = $this->userBackend->getLDAPAccess($uid)->username2dn($uid);
92
-		if(!$result){
92
+		if (!$result) {
93 93
 			throw new \Exception('Translation to LDAP DN unsuccessful');
94 94
 		}
95 95
 		return $result;
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 * @throws \Exception
103 103
 	 */
104 104
 	public function getGroupDN($gid) {
105
-		if(!$this->groupBackend->groupExists($gid)){
105
+		if (!$this->groupBackend->groupExists($gid)) {
106 106
 			throw new \Exception('Group id not found in LDAP');
107 107
 		}
108 108
 		$result = $this->groupBackend->getLDAPAccess($gid)->groupname2dn($gid);
109
-		if(!$result){
109
+		if (!$result) {
110 110
 			throw new \Exception('Translation to LDAP DN unsuccessful');
111 111
 		}
112 112
 		return $result;	
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getUserName($dn) {
123 123
 		$result = $this->userBackend->dn2UserName($dn);
124
-		if(!$result){
124
+		if (!$result) {
125 125
 			throw new \Exception('Translation to internal user name unsuccessful');
126 126
 		}
127 127
 		return $result;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @throws \Exception if user id was not found in LDAP
154 154
 	 */
155 155
 	public function getLDAPConnection($uid) {
156
-		if(!$this->userBackend->userExists($uid)){
156
+		if (!$this->userBackend->userExists($uid)) {
157 157
 			throw new \Exception('User id not found in LDAP');
158 158
 		}
159 159
 		return $this->userBackend->getNewLDAPConnection($uid);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @throws \Exception if group id was not found in LDAP
168 168
 	 */
169 169
 	public function getGroupLDAPConnection($gid) {
170
-		if(!$this->groupBackend->groupExists($gid)){
170
+		if (!$this->groupBackend->groupExists($gid)) {
171 171
 			throw new \Exception('Group id not found in LDAP');
172 172
 		}
173 173
 		return $this->groupBackend->getNewLDAPConnection($gid);
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 	 * @throws \Exception if user id was not found in LDAP
181 181
 	 */
182 182
 	public function getLDAPBaseUsers($uid) {
183
-		if(!$this->userBackend->userExists($uid)){
183
+		if (!$this->userBackend->userExists($uid)) {
184 184
 			throw new \Exception('User id not found in LDAP');
185 185
 		}
186 186
 		$access = $this->userBackend->getLDAPAccess($uid);
187 187
 		$bases = $access->getConnection()->ldapBaseUsers;
188 188
 		$dn = $this->getUserDN($uid);
189 189
 		foreach ($bases as $base) {
190
-			if($access->isDNPartOfBase($dn, [$base])) {
190
+			if ($access->isDNPartOfBase($dn, [$base])) {
191 191
 				return $base;
192 192
 			}
193 193
 		}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @throws \Exception if user id was not found in LDAP
211 211
 	 */
212 212
 	public function getLDAPBaseGroups($uid) {
213
-		if(!$this->userBackend->userExists($uid)){
213
+		if (!$this->userBackend->userExists($uid)) {
214 214
 			throw new \Exception('User id not found in LDAP');
215 215
 		}
216 216
 		$bases = $this->userBackend->getLDAPAccess($uid)->getConnection()->ldapBaseGroups;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @throws \Exception if user id was not found in LDAP
224 224
 	 */
225 225
 	public function clearCache($uid) {
226
-		if(!$this->userBackend->userExists($uid)){
226
+		if (!$this->userBackend->userExists($uid)) {
227 227
 			throw new \Exception('User id not found in LDAP');
228 228
 		}
229 229
 		$this->userBackend->getLDAPAccess($uid)->getConnection()->clearCache();
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @throws \Exception if user id was not found in LDAP
237 237
 	 */
238 238
 	public function clearGroupCache($gid) {
239
-		if(!$this->groupBackend->groupExists($gid)){
239
+		if (!$this->groupBackend->groupExists($gid)) {
240 240
 			throw new \Exception('Group id not found in LDAP');
241 241
 		}
242 242
 		$this->groupBackend->getLDAPAccess($gid)->getConnection()->clearCache();
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * @throws \Exception if user id was not found in LDAP
276 276
 	 */
277 277
 	public function getLDAPDisplayNameField($uid) {
278
-		if(!$this->userBackend->userExists($uid)){
278
+		if (!$this->userBackend->userExists($uid)) {
279 279
 			throw new \Exception('User id not found in LDAP');
280 280
 		}
281 281
 		return $this->userBackend->getLDAPAccess($uid)->getConnection()->getConfiguration()['ldap_display_name'];
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @throws \Exception if user id was not found in LDAP
289 289
 	 */
290 290
 	public function getLDAPEmailField($uid) {
291
-		if(!$this->userBackend->userExists($uid)){
291
+		if (!$this->userBackend->userExists($uid)) {
292 292
 			throw new \Exception('User id not found in LDAP');
293 293
 		}
294 294
 		return $this->userBackend->getLDAPAccess($uid)->getConnection()->getConfiguration()['ldap_email_attr'];
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 * @throws \Exception if group id was not found in LDAP
302 302
 	 */
303 303
 	public function getLDAPGroupMemberAssoc($gid) {
304
-		if(!$this->groupBackend->groupExists($gid)){
304
+		if (!$this->groupBackend->groupExists($gid)) {
305 305
 			throw new \Exception('Group id not found in LDAP');
306 306
 		}
307 307
 		return $this->groupBackend->getLDAPAccess($gid)->getConnection()->getConfiguration()['ldap_group_member_assoc_attribute'];
Please login to merge, or discard this patch.