This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,15 @@ class BindsLdapUserModel
1919 */
2020 public function handle ($ event )
2121 {
22- // Before we bind the users LDAP model, we will verify they are using the
23- // Adldap authentication provider, the required trait, and the
24- // users LDAP property has not already been set.
22+ // Before we bind the users LDAP model, we will verify they are using the Adldap
23+ // authentication provider, the required trait, the users LDAP property has
24+ // not already been set, and we have located an LDAP user to bind .
2525 if (
2626 $ this ->isUsingAdldapProvider ($ event ->guard )
2727 && $ this ->canBind ($ event ->user )
28- && is_null ($ event ->user -> ldap )
28+ && $ user = Resolver:: byModel ($ event ->user )
2929 ) {
30- $ event ->user ->setLdapUser (
31- Resolver::byModel ($ event ->user )
32- );
30+ $ event ->user ->setLdapUser ($ user );
3331 }
3432 }
3533
@@ -54,6 +52,6 @@ protected function isUsingAdldapProvider($guard) : bool
5452 */
5553 protected function canBind (Authenticatable $ user ) : bool
5654 {
57- return array_key_exists (HasLdapUser::class, class_uses_recursive ($ user ));
55+ return array_key_exists (HasLdapUser::class, class_uses_recursive ($ user )) && is_null ( $ user -> ldap ) ;
5856 }
5957}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function setConnection($connection)
5656 */
5757 public function byId ($ identifier )
5858 {
59- return $ this ->query ()->findByGuid ($ identifier );
59+ return $ this ->query ()->findByGuid ($ identifier ) ?? null ;
6060 }
6161
6262 /**
@@ -90,9 +90,7 @@ public function byCredentials(array $credentials = [])
9090 */
9191 public function byModel (Authenticatable $ model )
9292 {
93- $ identifier = $ this ->getDatabaseIdColumn ();
94-
95- return $ this ->query ()->whereEquals ($ identifier , $ model ->{$ identifier })->first ();
93+ return $ this ->byId ($ model ->{$ this ->getDatabaseIdColumn ()});
9694 }
9795
9896 /**
You can’t perform that action at this time.
0 commit comments