commit
50fcf9b194
@ -264,6 +264,7 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
if (preg_match('/\.(h)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; }
|
||||
if (preg_match('/\.(java|jsp)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; }
|
||||
if (preg_match('/\.php([0-9]{1})?$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; }
|
||||
if (preg_match('/\.phtml$/i',$tmpfile)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; }
|
||||
if (preg_match('/\.(pl|pm)$/i',$tmpfile)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; }
|
||||
if (preg_match('/\.sql$/i',$tmpfile)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; }
|
||||
if (preg_match('/\.js$/i',$tmpfile)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; }
|
||||
|
||||
@ -148,6 +148,8 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
// ldap2dolibarr synchronisation
|
||||
if ($login && ! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
|
||||
{
|
||||
dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr");
|
||||
|
||||
// On charge les attributs du user ldap
|
||||
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
||||
$resultFetchLdapUser = $ldap->fetch($login,$userSearchFilter);
|
||||
@ -164,6 +166,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
$resultFetchUser=$user->fetch('',$login,$sid);
|
||||
if ($resultFetchUser > 0)
|
||||
{
|
||||
dol_syslog("functions_ldap::check_user_password_ldap Sync user found id=".$user->id);
|
||||
// On verifie si le login a change et on met a jour les attributs dolibarr
|
||||
if ($user->login != $ldap->login && $ldap->login)
|
||||
{
|
||||
@ -171,7 +174,8 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
$user->update($user);
|
||||
// TODO Que faire si update echoue car on update avec un login deja existant.
|
||||
}
|
||||
//$resultUpdate = $user->update_ldap2dolibarr();
|
||||
|
||||
//$resultUpdate = $user->update_ldap2dolibarr($ldap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,7 +1153,7 @@ class User extends CommonObject
|
||||
{
|
||||
// Si mot de passe saisi et different de celui en base
|
||||
$result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncmemberpass);
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2070,6 +2070,34 @@ class User extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user using data from the LDAP
|
||||
* // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
|
||||
*/
|
||||
function update_ldap2dolibarr(&$ldapuser) {
|
||||
global $user, $conf;
|
||||
|
||||
$this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME};
|
||||
$this->lastname=$ldapuser->{$conf->global->LDAP_FIELD_NAME};
|
||||
$this->login=$ldapuser->{$conf->global->LDAP_FIELD_LOGIN};
|
||||
$this->pass=$ldapuser->{$conf->global->LDAP_FIELD_PASSWORD};
|
||||
$this->pass_indatabase_crypted=$ldapuser->{$conf->global->LDAP_FIELD_PASSWORD_CRYPTED};
|
||||
|
||||
$this->office_phone=$ldapuser->{$conf->global->LDAP_FIELD_PHONE};
|
||||
$this->user_mobile=$ldapuser->{$conf->global->LDAP_FIELD_MOBILE};
|
||||
$this->office_fax=$ldapuser->{$conf->global->LDAP_FIELD_FAX};
|
||||
$this->email=$ldapuser->{$conf->global->LDAP_FIELD_MAIL};
|
||||
$this->ldap_sid=$ldapuser->{$conf->global->LDAP_FIELD_SID};
|
||||
|
||||
$this->job=$ldapuser->{$conf->global->LDAP_FIELD_TITLE};
|
||||
$this->note=$ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION};
|
||||
|
||||
$result = $this->update($user);
|
||||
|
||||
dol_syslog(get_class($this)."::update_ldap2dolibarr result=".$result, LOG_DEBUG);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -324,7 +324,9 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
$object->firstname = GETPOST("prenom");
|
||||
$object->login = GETPOST("login");
|
||||
$object->pass = GETPOST("password");
|
||||
$object->admin = GETPOST("admin");
|
||||
if($user->admin == 1) { // A user can only be set admin by an admin
|
||||
$object->admin = GETPOST("admin");
|
||||
}
|
||||
$object->office_phone=GETPOST("office_phone");
|
||||
$object->office_fax = GETPOST("office_fax");
|
||||
$object->user_mobile= GETPOST("user_mobile");
|
||||
|
||||
@ -200,6 +200,7 @@ if ($result >= 0)
|
||||
$fuser->user_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE];
|
||||
$fuser->office_fax=$ldapuser[$conf->global->LDAP_FIELD_FAX];
|
||||
$fuser->email=$ldapuser[$conf->global->LDAP_FIELD_MAIL];
|
||||
$fuser->ldap_sid=$ldapuser[$conf->global->LDAP_FIELD_SID];
|
||||
|
||||
$fuser->job=$ldapuser[$conf->global->LDAP_FIELD_TITLE];
|
||||
$fuser->note=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user