Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
mhetru committed Mar 1, 2020
1 parent 5c29205 commit fa8e6fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Entity/LdapUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function eraseCredentials() {
}

public function equals(UserInterface $user) {
if(!$user instanceof People) {
if(!$user instanceof LdapUser) {
return false;
}

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Symfony 2/3/4 User provider from LDAP
Symfony 2/3/4/5 User provider from LDAP

(author : Universite Lille)


Allow use LDAP like user provider and security in application written in Symfony2/3/4
Allow use LDAP like user provider and security in application written in Symfony2/3/4/5

Installation of the Bundle.
---
Expand Down Expand Up @@ -37,7 +37,7 @@ class AppKernel extends Kernel
}
```

For Symfony 4 :
For Symfony 4 and 5 :
Verify if the lines are present in config/bundles.php file (if not present, just add the lines) :
```
# config/bundles.php
Expand Down Expand Up @@ -98,10 +98,10 @@ security:
id: ldap_user_provider
```

For Symfony 4 :
in the configuration file .env.dist and .env, add this :
For Symfony 4 and 5 :
in the configuration file .env.local and .env, add this :
```
# .env.dist
# .env.local
# .env
...
###> l3/ldap-user-bundle ###
Expand All @@ -112,7 +112,7 @@ LDAP_PASSWORD=password
###< l3/ldap-user-bundle ###
...
```
and configure the values in the file .env
and configure the values in the file .env.local

next add this lines in the config/services.yaml file (under parameters) :
```
Expand Down
10 changes: 8 additions & 2 deletions Services/LdapUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public function refreshUser(UserInterface $user) {
}

public function supportsClass($class) {
return $class === 'L3\Bundle\UserLdapBundle\Entity\LdapUser';
$version_php = phpversion();
$version_php_float = floatval($version_php);
if ($version_php_float >= 5.5) {
return LdapUser::class === $class;
} else {
return $class === 'L3\Bundle\UserLdapBundle\Entity\LdapUser';
}
}
}
}

0 comments on commit fa8e6fb

Please sign in to comment.