Completed
Branch master (00afa1)
by Gaetano
23:41 queued 13:49
created
Security/User/Provider/RemoteUser.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,15 +3,12 @@
 block discarded – undo
3 3
 namespace Kaliop\IdentityManagementBundle\Security\User\Provider;
4 4
 
5 5
 use Symfony\Component\Security\Core\User\UserProviderInterface;
6
-use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
7 6
 use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
8 7
 use Symfony\Component\Security\Core\User\UserInterface;
9
-use Kaliop\IdentityManagementBundle\Security\User\AMSUser as UserClass;
10 8
 use Kaliop\IdentityManagementBundle\Security\User\RemoteUserProviderInterface;
11 9
 use Kaliop\IdentityManagementBundle\Security\User\RemoteUser as KaliopRemoteUser;
12 10
 use Kaliop\IdentityManagementBundle\Security\User\RemoteUserHandlerInterface;
13 11
 use eZ\Publish\Core\MVC\Symfony\Security\User\APIUserProviderInterface;
14
-use eZ\Publish\Core\MVC\Symfony\Security\User as eZMVCUser;
15 12
 use Psr\Log\LoggerInterface;
16 13
 
17 14
 class RemoteUser implements UserProviderInterface, RemoteUserProviderInterface
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
             }
109 109
 
110 110
         } catch (\Exception $e) {
111
-            if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service: " . $e->getMessage());
111
+            if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service: ".$e->getMessage());
112 112
             throw $e;
113 113
         }
114 114
 
Please login to merge, or discard this patch.
Security/User/RemoteUserHandler.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Kaliop\IdentityManagementBundle\Adapter\ClientInterface;
6 6
 use eZ\Publish\API\Repository\Repository;
7
-use eZ\Publish\API\Repository\Values\Content\Query;
8
-use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
9 7
 use eZ\Publish\API\Repository\Values\User\User;
10 8
 use eZ\Publish\API\Repository\Exceptions\NotFoundException;
11 9
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                         $newUserGroups = $this->getGroupsFromProfile($profile);
135 135
                         $currentUserGroups = $userService->loadUserGroupsOfUser($eZUser);
136 136
                         $groupsToRemove = array();
137
-                        foreach($currentUserGroups as $currentUserGroup) {
137
+                        foreach ($currentUserGroups as $currentUserGroup) {
138 138
                             if (!array_key_exists($currentUserGroup->id, $newUserGroups)) {
139 139
                                 $groupsToRemove[] = $currentUserGroup;
140 140
                             } else {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
     protected function getRemoteIdFromProfile($profile)
166 166
     {
167
-        return $this->remoteIdPrefix . $this->profileHash($profile);
167
+        return $this->remoteIdPrefix.$this->profileHash($profile);
168 168
     }
169 169
 
170 170
     /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param string $prefix
212 212
      * @return string
213 213
      */
214
-    protected function createTempFile($data, $prefix='')
214
+    protected function createTempFile($data, $prefix = '')
215 215
     {
216 216
         $imageFileName = trim(tempnam(sys_get_temp_dir(), $prefix), '.');
217 217
         file_put_contents($imageFileName, $data);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     protected function cleanUpAfterUserCreation()
227 227
     {
228 228
         foreach ($this->tempFiles as $fileName) {
229
-            if (is_file( $fileName))
229
+            if (is_file($fileName))
230 230
                 unlink($fileName);
231 231
         }
232 232
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     protected function cleanUpAfterUserUpdate()
238 238
     {
239 239
         foreach ($this->tempFiles as $fileName) {
240
-            if (is_file( $fileName))
240
+            if (is_file($fileName))
241 241
                 unlink($fileName);
242 242
         }
243 243
     }
Please login to merge, or discard this patch.
DependencyInjection/KaliopIdentityManagementExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
     {
25 25
         $loader = new YamlFileLoader(
26 26
             $container,
27
-            new FileLocator( __DIR__ . '/../Resources/config' )
27
+            new FileLocator(__DIR__.'/../Resources/config')
28 28
         );
29 29
 
30 30
         // New services
31
-        $loader->load( 'services.yml' );
31
+        $loader->load('services.yml');
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
Adapter/LDAP/RemoteUser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *       Note that the list of attributes gotten from ladp is decided by settings for the client class...
24 24
      * @todo store the password salted and encrypted in memory instead of plaintext
25 25
      */
26
-    public function __construct($authUserResult, $emailField, $login, $password='')
26
+    public function __construct($authUserResult, $emailField, $login, $password = '')
27 27
     {
28 28
         $this->username = $login;
29 29
         $this->password = $password;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function ldap2array($data) {
73 73
         //return $data;
74
-        foreach($data as $key => $value) {
74
+        foreach ($data as $key => $value) {
75 75
             if ($key === 'dn') {
76 76
                 continue;
77 77
             }
Please login to merge, or discard this patch.
Adapter/LDAP/Client.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,14 +91,14 @@
 block discarded – undo
91 91
             }
92 92
 
93 93
             if ($search['count'] > 1) {
94
-                if ($this->logger) $this->logger->warning('More than one ldap account found for ' . $username);
94
+                if ($this->logger) $this->logger->warning('More than one ldap account found for '.$username);
95 95
 
96 96
                 throw new AuthenticationServiceException('More than one user found');
97 97
             }
98 98
 
99 99
             // always carry out this check, as the data is needed to log in
100 100
             if (!isset($this->settings['ldap_login_attribute']) || !isset($search[0][$this->settings['ldap_login_attribute']][0])) {
101
-                if ($this->logger) $this->logger->info("Authentication failed for user: '$username', missing attribute used to log in to ldap: " . @$this->settings['ldap_login_attribute']);
101
+                if ($this->logger) $this->logger->info("Authentication failed for user: '$username', missing attribute used to log in to ldap: ".@$this->settings['ldap_login_attribute']);
102 102
 
103 103
                 throw new AuthenticationServiceException('Invalid user profile: missing ldap attribute needed for log-in');
104 104
             }
Please login to merge, or discard this patch.
Traits/User.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
     protected $securityToken = null;
10 10
 
11 11
     protected function isAuthenticated() {
12
-        if( $this->securityToken == null ) {
13
-            $securityToken = $this->container->get( 'security.token_storage' )->getToken();
14
-            if( $securityToken instanceof TokenInterface ) {
12
+        if ($this->securityToken == null) {
13
+            $securityToken = $this->container->get('security.token_storage')->getToken();
14
+            if ($securityToken instanceof TokenInterface) {
15 15
                 $this->securityToken = $securityToken;
16 16
             }
17 17
         }
18 18
 
19
-        return $this->securityToken->isAuthenticated() === true && count( $this->securityToken->getRoles() );
19
+        return $this->securityToken->isAuthenticated() === true && count($this->securityToken->getRoles());
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
Security/Authentication/Provider/RemoteUserAuthenticationProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,10 +156,10 @@
 block discarded – undo
156 156
                 //$user = $this->userProvider->loadUserByUsername($username);
157 157
                 return $user;
158 158
 
159
-            } catch(AuthenticationException $e) {
159
+            } catch (AuthenticationException $e) {
160 160
                 // let through any exception of the expected authentication type
161 161
                 throw $e;
162
-            } catch(\Exception $e) {
162
+            } catch (\Exception $e) {
163 163
                 // we mask any internal, unexpected error from the Client
164 164
                 /// @todo we should log a message here: the Client used an unexpected exception type...
165 165
                 /// @tood we should really be using an AuthenticationServiceException here
Please login to merge, or discard this patch.
identitymanagementextension/login_handler/ezremoteuserloginuser.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
      * @param bool $authenticationMatch
15 15
      * @return bool|mixed
16 16
      */
17
-    static function loginUser( $login, $password, $authenticationMatch = false )
17
+    static function loginUser($login, $password, $authenticationMatch = false)
18 18
     {
19
-        $user = self::_loginUser( $login, $password, $authenticationMatch );
19
+        $user = self::_loginUser($login, $password, $authenticationMatch);
20 20
 
21
-        if ( is_object( $user ) )
21
+        if (is_object($user))
22 22
         {
23
-            self::loginSucceeded( $user );
23
+            self::loginSucceeded($user);
24 24
             return $user;
25 25
         }
26 26
         else
27 27
         {
28
-            self::loginFailed( $user, $login );
28
+            self::loginFailed($user, $login);
29 29
             return false;
30 30
         }
31 31
     }
32 32
 
33
-    protected static function _loginUser( $login, $password, $authenticationMatch = false )
33
+    protected static function _loginUser($login, $password, $authenticationMatch = false)
34 34
     {
35 35
         $fwName = eZINI::instance('identitymanagement.ini')->variable('GeneralSettings', 'FirewallName');
36 36
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 
61 61
             return self::fetch($user->id);
62 62
 
63
-        } catch(\Exception $e) {
63
+        } catch (\Exception $e) {
64 64
             /// @todo make it easier to tell apart system error from user errors such as bad password...
65 65
 
66
-            eZDebug::writeError($e->getMessage(), __METHOD__ );
66
+            eZDebug::writeError($e->getMessage(), __METHOD__);
67 67
 
68 68
             return false;
69 69
         }
Please login to merge, or discard this patch.
ezpublish_legacy/identitymanagementextension/settings/site.ini.append.php 1 patch
Spacing   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,1 @@
 block discarded – undo
1
-<?php /*
2
-
3
-[UserSettings]
4
-ExtensionDirectory[]=identitymanagementextension
5
-LoginHandler[]=RemoteUserLogin
6 1
\ No newline at end of file
2
+<?php 
7 3
\ No newline at end of file
Please login to merge, or discard this patch.