Skip to content

Commit

Permalink
Homogénéisation de la gestion des login compte/ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
teymour committed Apr 30, 2024
1 parent 185c187 commit f4e8ab8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,26 +605,39 @@ public function getLogin() {
return $this->_get('login');
}

if($this->mot_de_passe) {
if (SocieteConfiguration::getInstance()->isIdentifiantEtablissementSaisi()) {

return $this->identifiant;
}
if($this->mot_de_passe) {

if(!$this->mot_de_passe && !$this->getSociete()->getContact()->mot_de_passe) {
return null;
return $this->identifiant;
}

if(!$this->mot_de_passe && !$this->getSociete()->getContact()->mot_de_passe) {
return null;
}

if($this->isSocieteContact()) {

return $this->identifiant;
}

if($this->compte_type == CompteClient::TYPE_COMPTE_INTERLOCUTEUR) {

return $this->identifiant;
}

return $this->getSociete()->getMasterCompte()->login;
}

if($this->isSocieteContact()) {

return $this->identifiant;
return $this->getSociete()->identifiant;
}

if($this->compte_type == CompteClient::TYPE_COMPTE_INTERLOCUTEUR) {

return $this->identifiant;
}

return $this->getSociete()->getMasterCompte()->login;
return preg_replace('/01$/', '', $this->identifiant);
}

public function setMotDePasseSSHA($mot_de_passe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,32 @@ public function deleteCompte($compte, $verbose = 0)
if (is_string($compte)) {
$identifiant = $compte;
}else {
$identifiant = self::getIdentifiant($compte);
$identifiant = $compte->login;
}
if ($verbose) {
echo $identifiant." deleted\n";
}
return $this->delete($identifiant);
}

public static function getIdentifiant($compte)
{
$login = $compte->login;

if(!$login) {

return $compte->identifiant;
}

return $login;
}

/**
*
* @param _Compte $compte
* @return array
*/
protected function info($compte)
public function info($compte)
{
$info = array();
$info['uid'] = self::getIdentifiant($compte);
$info['uid'] = $compte->login;
$info['cn'] = self::replace_invalid_syntax($compte->nom_a_afficher);
$info['objectClass'][0] = 'top';
$info['objectClass'][1] = 'person';
$info['objectClass'][2] = 'posixAccount';
$info['objectClass'][3] = 'inetOrgPerson';
$info['loginShell'] = '/bin/bash';
$info['uidNumber'] = (int)self::getIdentifiant($compte);
$info['uidNumber'] = (int)$compte->login;
$info['gidNumber'] = '1000';
$info['homeDirectory'] = '/home/'.$compte->_id;
$info['homeDirectory'] = '/home/'.$compte->login;
$info['gecos'] = self::getGecos($compte);
if ($compte->isEtablissementContact()) {
$info['businessCategory'] = $compte->getEtablissement()->famille;
Expand Down

0 comments on commit f4e8ab8

Please sign in to comment.