adhomeDirectory
This commit is contained in:
@ -6,8 +6,8 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Cadoles\CoreBundle\Validator as CadolesCoreAssert;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Cadoles\CoreBundle\Validator\Password;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,6 +44,7 @@ class User implements UserInterface, \Serializable
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=250)
|
||||
* @CadolesCoreAssert\PasswordValidator
|
||||
*/
|
||||
private $password;
|
||||
|
||||
|
@ -109,6 +109,7 @@ services:
|
||||
- %ldap_port%
|
||||
- %ldap_tls%
|
||||
- %ldap_type%
|
||||
- %ldap_addomaine%
|
||||
calls:
|
||||
- [setUser, ["%ldap_user%"]]
|
||||
- [setPassword, ["%ldap_password%"]]
|
||||
|
@ -15,23 +15,27 @@ class ldapService
|
||||
protected $port;
|
||||
protected $tls;
|
||||
protected $type;
|
||||
protected $addomaine;
|
||||
|
||||
protected $baseDN;
|
||||
protected $baseUser;
|
||||
protected $baseNiveau01;
|
||||
protected $baseNiveau02;
|
||||
protected $baseGroup;
|
||||
|
||||
|
||||
protected $user = null;
|
||||
protected $password = null;
|
||||
private $connection = null;
|
||||
private $ldapSync = false;
|
||||
|
||||
public function __construct($host, $port, $tls, $type)
|
||||
public function __construct($host, $port, $tls, $type, $addomaine)
|
||||
{
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->tls = $tls;
|
||||
$this->type = $type;
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->tls = $tls;
|
||||
$this->type = $type;
|
||||
$this->addomaine = $addomaine;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
@ -312,6 +316,7 @@ class ldapService
|
||||
$attrs['sAMAccountName'] = $user->getUsername();
|
||||
$attrs["userAccountControl"] = 544;
|
||||
$attrs["homeDrive"] = "U:";
|
||||
$attrs["homeDirectory"] = "\\\\".$this->addomaine."\\".$user->getUsername();
|
||||
}
|
||||
|
||||
$attrs['givenName'] = $user->getFirstname();
|
||||
|
@ -4,10 +4,15 @@ namespace Cadoles\CoreBundle\Validator;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
class PasswordValidator extends ConstraintValidator
|
||||
{
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
$this->context->addViolation($constraint->message);
|
||||
|
||||
if(!empty($value)) {
|
||||
if (strlen($value) < '8') {
|
||||
$this->context->addViolation($constraint->message);
|
||||
|
Reference in New Issue
Block a user