mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
move code to update/add user into protected function
This commit is contained in:
parent
7b8f3ef0bb
commit
5de8c66d1f
|
@ -26,7 +26,20 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
|
||||||
|
|
||||||
var $dms;
|
var $dms;
|
||||||
|
|
||||||
var $settings;
|
var $settings;
|
||||||
|
|
||||||
|
protected function addUser($username, $info) {
|
||||||
|
return $dms->addUser($username, null, $info['cn'][0], $info['mail'][0], $settings->_language, $settings->_theme, "", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updateUser($user, $info) {
|
||||||
|
if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) {
|
||||||
|
$user->setFullName($info['cn'][0]);
|
||||||
|
}
|
||||||
|
if(isset($info['mail'][0]) && ($info['mail'][0] != $user->getEmail())) {
|
||||||
|
$user->setEmail($info['mail'][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct($dms, $settings) { /* {{{ */
|
public function __construct($dms, $settings) { /* {{{ */
|
||||||
$this->dms = $dms;
|
$this->dms = $dms;
|
||||||
|
@ -131,10 +144,6 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
|
|
||||||
$user = $dms->addUser($username, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "", 0);
|
|
||||||
=======
|
|
||||||
// Successfully authenticated. Now check to see if the user exists within
|
// Successfully authenticated. Now check to see if the user exists within
|
||||||
// the database. If not, add them in if _restricted is not set,
|
// the database. If not, add them in if _restricted is not set,
|
||||||
// but do not add their password.
|
// but do not add their password.
|
||||||
|
@ -151,15 +160,9 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
|
||||||
|
|
||||||
if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
|
if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
|
||||||
if (is_null($user)) {
|
if (is_null($user)) {
|
||||||
$user = $dms->addUser($username, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "", 3);
|
$user = $this->addUser($username, $info[0]);
|
||||||
} else {
|
} else {
|
||||||
if(isset($info[0]['cn'][0]) && ($info[0]['cn'][0] != $user->getFullName())) {
|
$this->updateUser($user, $info[0]);
|
||||||
$user->setFullName($info[0]['cn'][0]);
|
|
||||||
}
|
|
||||||
if(isset($info[0]['mail'][0]) && ($info[0]['mail'][0] != $user->getEmail())) {
|
|
||||||
$user->setEmail($info[0]['mail'][0]);
|
|
||||||
}
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user