diff --git a/README.md b/README.md index a17eccd..f5475a7 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Laravel documentation: [Authentication Quickstart](http://laravel.com/docs/maste - `Auth::user()->inGroup('GROUPNAME')` returns `boolean` if user belongs to `GROUPNAME` ### Ldap User Information -- `Auth::user()->getUsername()` returns authenticated users username. -- `Auth::user()->getFirstname()` returns authenticated users first name. -- `Auth::user()->getLastname()` returns authenticated users last name. -- `Auth::user()->getEmail()` returns authenticated users email address. +- `Auth::user()->getUsername()` returns authenticated username. +- `Auth::user()->getFirstname()` returns authenticated first name. +- `Auth::user()->getLastname()` returns authenticated last name. +- `Auth::user()->getEmail()` returns authenticated email address. diff --git a/src/Dsdevbe/LdapConnector/Adapter/Adldap.php b/src/Dsdevbe/LdapConnector/Adapter/Adldap.php index 3619d69..0aef216 100644 --- a/src/Dsdevbe/LdapConnector/Adapter/Adldap.php +++ b/src/Dsdevbe/LdapConnector/Adapter/Adldap.php @@ -3,6 +3,7 @@ namespace Dsdevbe\LdapConnector\Adapter; use adLDAP\adLDAP as adLDAPService; +use adLDAP\collections\adLDAPUserCollection as adLDAPUserCollection; use Dsdevbe\LdapConnector\Model\User as UserModel; class Adldap implements LdapInterface @@ -13,7 +14,7 @@ class Adldap implements LdapInterface protected $_password; - protected function mapDataToUserModel($user, array $groups) + protected function mapDataToUserModel(adLDAPUserCollection $user, array $groups) { $model = new UserModel([ 'username' => $user->samaccountname, @@ -54,7 +55,7 @@ public function connect($username, $password) */ public function isConnected() { - return !!$this->_ldap->getLdapBind(); + return (bool) $this->_ldap->getLdapBind(); } /** @@ -64,7 +65,7 @@ public function isConnected() */ public function getUserInfo($username) { - $user = $this->_ldap->user()->infoCollection($username, ['samaccountname','givenname','sn','mail']); + $user = $this->_ldap->user()->infoCollection($username, ['samaccountname', 'givenname', 'sn', 'mail']); if (!$user) { return; diff --git a/src/Dsdevbe/LdapConnector/Adapter/LdapInterface.php b/src/Dsdevbe/LdapConnector/Adapter/LdapInterface.php index 93ee360..efe8858 100644 --- a/src/Dsdevbe/LdapConnector/Adapter/LdapInterface.php +++ b/src/Dsdevbe/LdapConnector/Adapter/LdapInterface.php @@ -7,8 +7,8 @@ interface LdapInterface { /** - * @param String $username - * @param String $password + * @param string $username + * @param string $password * * @return bool */ diff --git a/src/Dsdevbe/LdapConnector/LdapConnectorServiceProvider.php b/src/Dsdevbe/LdapConnector/LdapConnectorServiceProvider.php index ba15791..62c911d 100644 --- a/src/Dsdevbe/LdapConnector/LdapConnectorServiceProvider.php +++ b/src/Dsdevbe/LdapConnector/LdapConnectorServiceProvider.php @@ -23,7 +23,7 @@ class LdapConnectorServiceProvider extends ServiceProvider */ public function boot() { - Auth::extend('ldap', function ($app) { + Auth::extend('ldap', function($app) { $ldap = new Adldap( $this->getLdapAdapterConfig('adldap') ); @@ -40,7 +40,7 @@ public function boot() */ public function register() { - $ldapConfig = __DIR__.'/Config/ldap.php'; + $ldapConfig = __DIR__ . '/Config/ldap.php'; $this->publishConfig($ldapConfig); } diff --git a/src/Dsdevbe/LdapConnector/Model/User.php b/src/Dsdevbe/LdapConnector/Model/User.php index e0f61e8..22b7e16 100644 --- a/src/Dsdevbe/LdapConnector/Model/User.php +++ b/src/Dsdevbe/LdapConnector/Model/User.php @@ -147,5 +147,4 @@ public function getEmail() { return $this->_user['email']; } - }