diff --git a/dicos/91_ninegate.xml b/dicos/91_ninegate.xml index 0dddd1cf..fe855ba2 100644 --- a/dicos/91_ninegate.xml +++ b/dicos/91_ninegate.xml @@ -102,6 +102,7 @@ LDAP + niveau01 @@ -689,6 +690,13 @@ ninegate_openldapreqgroup + + + AD + + ninegate_addomaine + + non diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php index 5af1772e..304ff36f 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php @@ -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; diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml index 0d85276d..b681c762 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml @@ -109,6 +109,7 @@ services: - %ldap_port% - %ldap_tls% - %ldap_type% + - %ldap_addomaine% calls: - [setUser, ["%ldap_user%"]] - [setPassword, ["%ldap_password%"]] diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php index 14c030d4..6cb37fb2 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php @@ -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(); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php index daa7914f..39f1487a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Validator/PasswordValidator.php @@ -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); diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml index c9da3494..80792440 100644 --- a/tmpl/ninegate-template.yml +++ b/tmpl/ninegate-template.yml @@ -135,6 +135,11 @@ parameters: ldap_password: %%pwdreader("",%%ldap_reader_passfile) %end if ldap_basedn: %%ldap_base_dn +%if %%getVar("ninegate_ldaptype", 'LDAP') == "AD" + ldap_addomaine: %%ninegate_addomaine +%else + ldap_addomaine: +%end if # Mise en page weburl: %%web_url