Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Tinebase/EmailUser): wrong email user id in setPluginPassword
Browse files Browse the repository at this point in the history
... with AD/LDAP user backend

-> always use Tinebase_Model_User objects!

Change-Id: Ia8952bbd0c157d1bc2ac44f21828fd93725beb5b
Reviewed-on: http://gerrit.tine20.com/customers/16687
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
  • Loading branch information
pschuele committed May 25, 2020
1 parent 3502085 commit 01d5b1b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tine20/Tinebase/User/ActiveDirectory.php
Expand Up @@ -256,7 +256,7 @@ public function setPassword($_userId, $_password, $_encrypt = TRUE, $_mustChange

$this->_db->update(SQL_TABLE_PREFIX . 'accounts', $values, $where);

$this->_setPluginsPassword($user->getId(), $_password, $_encrypt);
$this->_setPluginsPassword($user, $_password, $_encrypt);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tine20/Tinebase/User/Ldap.php
Expand Up @@ -413,7 +413,7 @@ public function setPassword($_userId, $_password, $_encrypt = TRUE, $_mustChange

$this->_db->update(SQL_TABLE_PREFIX . 'accounts', $values, $where);

$this->_setPluginsPassword($user->getId(), $_password, $_encrypt);
$this->_setPluginsPassword($user, $_password, $_encrypt);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tine20/Tinebase/User/Sql.php
Expand Up @@ -562,16 +562,16 @@ public function updateNtlmV2Hash($_userId, $_password)
/**
* set password in plugins
*
* @param Tinebase_Model_FullUser $user
* @param Tinebase_Model_FullUser $password
* @param bool $encrypt encrypt password
* @param Tinebase_Model_User $user
* @param string $password
* @param bool $encrypt encrypt password
* @throws Tinebase_Exception_Backend
*/
protected function _setPluginsPassword($user, $password, $encrypt = TRUE)
protected function _setPluginsPassword(Tinebase_Model_User $user, $password, $encrypt = TRUE)
{
foreach ($this->_sqlPlugins as $plugin) {
try {
$userId = $user instanceof Tinebase_Model_User ? $this->_getPluginUserId($plugin, $user) : $user;
$userId = $this->_getPluginUserId($plugin, $user);
$plugin->inspectSetPassword($userId, $password, $encrypt);
} catch (Exception $e) {
Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Could not change plugin password: ' . $e);
Expand All @@ -591,7 +591,7 @@ protected function _getPluginUserId($plugin, $user)
? $user->getEmailUserId()
: $user->getId();
}

/**
* ensure password policy
*
Expand Down Expand Up @@ -976,7 +976,7 @@ protected function _inspectCRUD($plugin, $user, $newUserProperties, $method)
if ($method !== 'inspectGetUserByProperty') {
$method = 'inspect' . ucfirst($method) . 'User';
}

// add email user xprops here if configured
if (Tinebase_EmailUser::isEmailUserPlugin($plugin) && Tinebase_Config::getInstance()->{Tinebase_Config::EMAIL_USER_ID_IN_XPROPS}) {
$pluginUser = clone($user);
Expand Down

0 comments on commit 01d5b1b

Please sign in to comment.