diff --git a/tine20/Addressbook/Controller/Contact.php b/tine20/Addressbook/Controller/Contact.php index bedc642969a..fc4f8de0e5b 100644 --- a/tine20/Addressbook/Controller/Contact.php +++ b/tine20/Addressbook/Controller/Contact.php @@ -1363,11 +1363,14 @@ public function inspectDeleteUser(Tinebase_Model_FullUser $_user) /** * update/set email user password * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { } diff --git a/tine20/Felamimail/Controller/Account.php b/tine20/Felamimail/Controller/Account.php index 2de586030a1..b0e8157a08b 100644 --- a/tine20/Felamimail/Controller/Account.php +++ b/tine20/Felamimail/Controller/Account.php @@ -819,7 +819,7 @@ protected function _beforeUpdateSharedAccount($_record, $_oldRecord) // always set defined username $_record->user = $emailUserBackend->getLoginName($user->getId(), $_record->email, $_record->email); $this->_beforeUpdateSharedAccountCredentials($_record, $_oldRecord); - Tinebase_EmailUser::getInstance(Tinebase_Config::IMAP)->inspectSetPassword($user->getId(), $_record->password); + Tinebase_EmailUser::getInstance()->inspectSetPassword($user->getId(), $_record->password); $this->_autoCreateSystemAccountFolders($_record); } } diff --git a/tine20/Tinebase/EmailUser/Imap/Cyrus.php b/tine20/Tinebase/EmailUser/Imap/Cyrus.php index a54ba9768fa..4ac176e0f10 100644 --- a/tine20/Tinebase/EmailUser/Imap/Cyrus.php +++ b/tine20/Tinebase/EmailUser/Imap/Cyrus.php @@ -148,12 +148,15 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { // nothing to be done for cyrus imap server } diff --git a/tine20/Tinebase/EmailUser/Imap/Dbmail.php b/tine20/Tinebase/EmailUser/Imap/Dbmail.php index c2b50760575..f39bc7d0431 100644 --- a/tine20/Tinebase/EmailUser/Imap/Dbmail.php +++ b/tine20/Tinebase/EmailUser/Imap/Dbmail.php @@ -198,15 +198,18 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) $_user->imapUser = $emailUser; $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, isset($_user->emailUser) ? $_user->emailUser : null); } - + /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { if (! $_encrypt && preg_match('/\{(.*)\}(.*)/', $_password, $matches)) { // if password should not be encrypted but already contains encryption type, we separate pw and type diff --git a/tine20/Tinebase/EmailUser/Imap/Standard.php b/tine20/Tinebase/EmailUser/Imap/Standard.php index 6472828b7a5..a178abeb51b 100644 --- a/tine20/Tinebase/EmailUser/Imap/Standard.php +++ b/tine20/Tinebase/EmailUser/Imap/Standard.php @@ -71,15 +71,18 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, $_user->emailUser); } } - + /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { // do nothing } diff --git a/tine20/Tinebase/EmailUser/Smtp/Standard.php b/tine20/Tinebase/EmailUser/Smtp/Standard.php index 78991bcbcf5..47de7c381cc 100644 --- a/tine20/Tinebase/EmailUser/Smtp/Standard.php +++ b/tine20/Tinebase/EmailUser/Smtp/Standard.php @@ -71,15 +71,18 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, $_user->emailUser); } } - + /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { // do nothing } diff --git a/tine20/Tinebase/EmailUser/Sql.php b/tine20/Tinebase/EmailUser/Sql.php index 8c9c551cdcb..4acc79416c3 100644 --- a/tine20/Tinebase/EmailUser/Sql.php +++ b/tine20/Tinebase/EmailUser/Sql.php @@ -273,15 +273,18 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) $_user->emailUser = Tinebase_EmailUser::merge(clone $_user->imapUser, $_user->emailUser); } } - + /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password - */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE) + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void + */ + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { if (!isset($this->_propertyMapping['emailPassword'])) { return; diff --git a/tine20/Tinebase/User/LdapPlugin/Interface.php b/tine20/Tinebase/User/LdapPlugin/Interface.php index a735c58f1e7..10c43f5bb74 100644 --- a/tine20/Tinebase/User/LdapPlugin/Interface.php +++ b/tine20/Tinebase/User/LdapPlugin/Interface.php @@ -56,17 +56,18 @@ public function inspectExpiryDate($_expiryDate, array &$_ldapData); * @param array $_ldapData the data to be written to ldap */ public function inspectStatus($_status, array &$_ldapData); - + /** - * inspect set password - * - * @param string $_userId - * @param string $_password - * @param boolean $_encrypt - * @param boolean $_mustChange - * @param array $_ldapData the data to be written to ldap + * update/set email user password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt, $_mustChange, array &$_ldapData); + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []); /** * inspect get user by property diff --git a/tine20/Tinebase/User/Plugin/Abstract.php b/tine20/Tinebase/User/Plugin/Abstract.php index c5e11834ba9..235b76036bc 100644 --- a/tine20/Tinebase/User/Plugin/Abstract.php +++ b/tine20/Tinebase/User/Plugin/Abstract.php @@ -97,11 +97,14 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user) /** * update/set email user password * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = true) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { // do nothing here - implement in plugin if needed } diff --git a/tine20/Tinebase/User/Plugin/LdapInterface.php b/tine20/Tinebase/User/Plugin/LdapInterface.php index 4c9b89b94d7..56a1dc9a417 100644 --- a/tine20/Tinebase/User/Plugin/LdapInterface.php +++ b/tine20/Tinebase/User/Plugin/LdapInterface.php @@ -32,17 +32,18 @@ public function inspectAddUser(Tinebase_Model_FullUser $_user, array &$_ldapData * @param array $_ldapEntry */ public function inspectGetUserByProperty(Tinebase_Model_User $_user, array &$_ldapEntry); - + /** - * inspect set password - * - * @param string $_userId - * @param string $_password - * @param boolean $_encrypt - * @param boolean $_mustChange - * @param array $_ldapData the data to be written to ldap + * update/set email user password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt, $_mustChange, array &$_ldapData); + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []); /** * inspect data used to update user diff --git a/tine20/Tinebase/User/Plugin/Samba.php b/tine20/Tinebase/User/Plugin/Samba.php index 4114691f7f4..4486797668f 100644 --- a/tine20/Tinebase/User/Plugin/Samba.php +++ b/tine20/Tinebase/User/Plugin/Samba.php @@ -95,34 +95,35 @@ public function inspectStatus($_status, array &$_ldapData) $_ldapData['sambaacctflags'] = $acctFlags; } - + /** - * inspect set password - * - * @param string $_userId - * @param string $_password - * @param boolean $_encrypt - * @param boolean $_mustChange - * @param array $_ldapData the data to be written to ldap + * update/set email user password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = true, $_mustChange = false, array &$_ldapData = []) + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []) { if ($_encrypt !== true) { Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' can not transform crypted password into nt/lm samba password. Make sure to reset password for user ' . $_userId); } else { - $_ldapData['sambantpassword'] = Tinebase_User_Abstract::encryptPassword($_password, Tinebase_User_Abstract::ENCRYPT_NTPASSWORD); - $_ldapData['sambalmpassword'] = array(); + $_additionalData['sambantpassword'] = Tinebase_User_Abstract::encryptPassword($_password, Tinebase_User_Abstract::ENCRYPT_NTPASSWORD); + $_additionalData['sambalmpassword'] = array(); if ($_mustChange === true) { - $_ldapData['sambapwdmustchange'] = '1'; - $_ldapData['sambapwdcanchange'] = '1'; - $_ldapData['sambapwdlastset'] = array(); + $_additionalData['sambapwdmustchange'] = '1'; + $_additionalData['sambapwdcanchange'] = '1'; + $_additionalData['sambapwdlastset'] = array(); } else if ($_mustChange === false) { - $_ldapData['sambapwdmustchange'] = '2147483647'; - $_ldapData['sambapwdcanchange'] = '1'; - $_ldapData['sambapwdlastset'] = Tinebase_DateTime::now()->getTimestamp(); + $_additionalData['sambapwdmustchange'] = '2147483647'; + $_additionalData['sambapwdcanchange'] = '1'; + $_additionalData['sambapwdlastset'] = Tinebase_DateTime::now()->getTimestamp(); } else if ($_mustChange === null && $_userId instanceof Tinebase_Model_FullUser && @@ -130,10 +131,9 @@ public function inspectSetPassword($_userId, $_password, $_encrypt = true, $_mus isset($_userId->sambaSAM->pwdMustChange) && isset($_userId->sambaSAM->pwdCanChange)) { - $_ldapData['sambapwdmustchange'] = $_userId->sambaSAM->pwdMustChange->getTimestamp(); - $_ldapData['sambapwdcanchange'] = $_userId->sambaSAM->pwdCanChange->getTimestamp(); - $_ldapData['sambapwdlastset'] = array(); - + $_additionalData['sambapwdmustchange'] = $_userId->sambaSAM->pwdMustChange->getTimestamp(); + $_additionalData['sambapwdcanchange'] = $_userId->sambaSAM->pwdCanChange->getTimestamp(); + $_additionalData['sambapwdlastset'] = array(); } } } diff --git a/tine20/Tinebase/User/Plugin/SqlInterface.php b/tine20/Tinebase/User/Plugin/SqlInterface.php index c49ca3a2e55..3c33be21b2b 100644 --- a/tine20/Tinebase/User/Plugin/SqlInterface.php +++ b/tine20/Tinebase/User/Plugin/SqlInterface.php @@ -39,15 +39,18 @@ public function inspectGetUserByProperty(Tinebase_Model_User $_user); * @param Tinebase_Model_FullUser $_newUserProperties */ public function inspectUpdateUser(Tinebase_Model_FullUser $_updatedUser, Tinebase_Model_FullUser $_newUserProperties); - + /** * update/set email user password - * - * @param string $_userId - * @param string $_password - * @param bool $_encrypt encrypt password + * + * @param string $_userId + * @param string $_password + * @param bool $_encrypt + * @param bool $_mustChange + * @param array $_additionalData + * @return void */ - public function inspectSetPassword($_userId, $_password, $_encrypt = TRUE); + public function inspectSetPassword($_userId, string $_password, bool $_encrypt = true, bool $_mustChange = false, array &$_additionalData = []); /** * delete user by id diff --git a/tine20/Tinebase/User/Sql.php b/tine20/Tinebase/User/Sql.php index c75a43cb80f..c81cc41c509 100644 --- a/tine20/Tinebase/User/Sql.php +++ b/tine20/Tinebase/User/Sql.php @@ -580,7 +580,7 @@ public function updateNtlmV2Hash($_userId, $_password) * @param bool $encrypt encrypt password * @throws Tinebase_Exception_Backend */ - protected function _setPluginsPassword(Tinebase_Model_User $user, $password, $encrypt = TRUE) + protected function _setPluginsPassword(Tinebase_Model_User $user, $password, $encrypt = true) { foreach ($this->_sqlPlugins as $plugin) { try {