mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-01-12 22:20:12 +01:00
fixed an issue with ldap_sync in case of the users DN is changed
This commit is contained in:
parent
e688ce0420
commit
ca689e4b30
@ -211,6 +211,13 @@ class ModelUserImport extends Model {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
/* update DN field if it's an existing user */
|
||||||
|
|
||||||
|
if(($cuid = $this->model_user_user->get_uid_by_name($_user['username'])) > 0) {
|
||||||
|
$this->model_user_user->update_dn_by_uid($cuid, $_user['dn']);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* or add the new user */
|
/* or add the new user */
|
||||||
|
|
||||||
$user = $this->createNewUserArray($_user['dn'], $_user['username'], $_user['realname'], $_user['emails'], $globals);
|
$user = $this->createNewUserArray($_user['dn'], $_user['username'], $_user['realname'], $_user['emails'], $globals);
|
||||||
|
@ -445,6 +445,20 @@ class ModelUserUser extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update_dn_by_uid($uid = 0, $new_dn = '') {
|
||||||
|
if(!$this->check_uid($uid) || $new_dn == ''){ return 0; }
|
||||||
|
|
||||||
|
$user = $this->get_user_by_uid($uid);
|
||||||
|
|
||||||
|
if(isset($user['uid']) && $user['dn'] != '' && $user['dn'] != '*') {
|
||||||
|
$query = $this->db->query("UPDATE " . TABLE_USER . " SET dn=? WHERE uid=?", array($new_dn, $uid));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function delete_user($uid) {
|
public function delete_user($uid) {
|
||||||
if(!$this->check_uid($uid)){ return 0; }
|
if(!$this->check_uid($uid)){ return 0; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user