mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +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 $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) { /* {{{ */
|
||||
$this->dms = $dms;
|
||||
|
@ -131,10 +144,6 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
|
|||
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
|
||||
// the database. If not, add them in if _restricted is not set,
|
||||
// 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_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 {
|
||||
if(isset($info[0]['cn'][0]) && ($info[0]['cn'][0] != $user->getFullName())) {
|
||||
$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
|
||||
$this->updateUser($user, $info[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user