adhomeDirectory

This commit is contained in:
afornerot 2021-01-21 11:35:12 +01:00
parent ceeac44ede
commit f75058bc30
6 changed files with 31 additions and 6 deletions

View File

@ -102,6 +102,7 @@
<variable type='string' name='ninegate_openldapsubbranchuser' description="Rechercher les utilisateurs dans la sous-branche" mandatory='False' /> <variable type='string' name='ninegate_openldapsubbranchuser' description="Rechercher les utilisateurs dans la sous-branche" mandatory='False' />
<variable type='string' name='ninegate_ldaptype' description="Annuaire Cadoles LDAP ou AD " mandatory='True'><value>LDAP</value></variable> <variable type='string' name='ninegate_ldaptype' description="Annuaire Cadoles LDAP ou AD " mandatory='True'><value>LDAP</value></variable>
<variable type='string' name='ninegate_addomaine' description="Nom de votre domaine AD" mandatory='True'><value></value></variable>
<variable type='string' name='ninegate_pwdadmin' description="Mot de passe du compte admin durant l'instance (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable> <variable type='string' name='ninegate_pwdadmin' description="Mot de passe du compte admin durant l'instance (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
<variable type='string' name='ninegate_organization' description="Nom de l'organisation principale (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable> <variable type='string' name='ninegate_organization' description="Nom de l'organisation principale (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
<variable type='string' name='ninegate_niveau01branche' description="Nom de la branche de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>niveau01</value></variable> <variable type='string' name='ninegate_niveau01branche' description="Nom de la branche de Niveau 01 (idem valeur Cadoles ldap)" mandatory='True'><value>niveau01</value></variable>
@ -689,6 +690,13 @@
<target type='variable'>ninegate_openldapreqgroup</target> <target type='variable'>ninegate_openldapreqgroup</target>
</condition> </condition>
<!-- AFFICHAGE EN FONCTION DU MODE SCRIBE -->
<condition name='hidden_if_not_in' source='ninegate_ldaptype'>
<param>AD</param>
<target type='variable'>ninegate_addomaine</target>
</condition>
<!-- AFFICHAGE EN FONCTION DU MODULE PORTAL --> <!-- AFFICHAGE EN FONCTION DU MODULE PORTAL -->
<condition name='hidden_if_in' source='ninegate_activate_portal'> <condition name='hidden_if_in' source='ninegate_activate_portal'>
<param>non</param> <param>non</param>

View File

@ -6,8 +6,8 @@ use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Cadoles\CoreBundle\Validator as CadolesCoreAssert;
use Symfony\Component\Validator\Constraints as Assert; 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) * @ORM\Column(type="string", length=250)
* @CadolesCoreAssert\PasswordValidator
*/ */
private $password; private $password;

View File

@ -109,6 +109,7 @@ services:
- %ldap_port% - %ldap_port%
- %ldap_tls% - %ldap_tls%
- %ldap_type% - %ldap_type%
- %ldap_addomaine%
calls: calls:
- [setUser, ["%ldap_user%"]] - [setUser, ["%ldap_user%"]]
- [setPassword, ["%ldap_password%"]] - [setPassword, ["%ldap_password%"]]

View File

@ -15,23 +15,27 @@ class ldapService
protected $port; protected $port;
protected $tls; protected $tls;
protected $type; protected $type;
protected $addomaine;
protected $baseDN; protected $baseDN;
protected $baseUser; protected $baseUser;
protected $baseNiveau01; protected $baseNiveau01;
protected $baseNiveau02; protected $baseNiveau02;
protected $baseGroup; protected $baseGroup;
protected $user = null; protected $user = null;
protected $password = null; protected $password = null;
private $connection = null; private $connection = null;
private $ldapSync = false; private $ldapSync = false;
public function __construct($host, $port, $tls, $type) public function __construct($host, $port, $tls, $type, $addomaine)
{ {
$this->host = $host; $this->host = $host;
$this->port = $port; $this->port = $port;
$this->tls = $tls; $this->tls = $tls;
$this->type = $type; $this->type = $type;
$this->addomaine = $addomaine;
} }
public function isEnabled() { public function isEnabled() {
@ -312,6 +316,7 @@ class ldapService
$attrs['sAMAccountName'] = $user->getUsername(); $attrs['sAMAccountName'] = $user->getUsername();
$attrs["userAccountControl"] = 544; $attrs["userAccountControl"] = 544;
$attrs["homeDrive"] = "U:"; $attrs["homeDrive"] = "U:";
$attrs["homeDirectory"] = "\\\\".$this->addomaine."\\".$user->getUsername();
} }
$attrs['givenName'] = $user->getFirstname(); $attrs['givenName'] = $user->getFirstname();

View File

@ -4,10 +4,15 @@ namespace Cadoles\CoreBundle\Validator;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\ConstraintValidator;
/**
* @Annotation
*/
class PasswordValidator extends ConstraintValidator class PasswordValidator extends ConstraintValidator
{ {
public function validate($value, Constraint $constraint) public function validate($value, Constraint $constraint)
{ {
$this->context->addViolation($constraint->message);
if(!empty($value)) { if(!empty($value)) {
if (strlen($value) < '8') { if (strlen($value) < '8') {
$this->context->addViolation($constraint->message); $this->context->addViolation($constraint->message);

View File

@ -135,6 +135,11 @@ parameters:
ldap_password: %%pwdreader("",%%ldap_reader_passfile) ldap_password: %%pwdreader("",%%ldap_reader_passfile)
%end if %end if
ldap_basedn: %%ldap_base_dn ldap_basedn: %%ldap_base_dn
%if %%getVar("ninegate_ldaptype", 'LDAP') == "AD"
ldap_addomaine: %%ninegate_addomaine
%else
ldap_addomaine:
%end if
# Mise en page # Mise en page
weburl: %%web_url weburl: %%web_url