/** * @param \RainLoop\Account $oAccount * @param array $aAccounts = array() * * @return array */ public function SetAccounts($oAccount, $aAccounts = array()) { $sParentEmail = $oAccount->ParentEmailHelper(); if (!\is_array($aAccounts) || 0 >= \count($aAccounts) || 1 === \count($aAccounts) && !empty($aAccounts[$sParentEmail])) { $this->StorageProvider()->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::WebmailAccounts($sParentEmail)); } else { $this->StorageProvider()->Put(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::WebmailAccounts($sParentEmail), @\serialize($aAccounts)); } }
/** * @param string $sEmail * * @return bool */ public static function ClearUserData($sEmail) { if (0 < \strlen($sEmail)) { $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail); $oStorageProvider = \RainLoop\Api::Actions()->StorageProvider(); if ($oStorageProvider && $oStorageProvider->IsActive()) { // TwoFactor Auth User Data $oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::TwoFactorAuthUserData($sEmail)); // Accounts list $oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::WebmailAccounts($sEmail)); // Contact sync data $oStorageProvider->Clear($sEmail, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, 'contacts_sync'); } \RainLoop\Api::Actions()->SettingsProvider()->ClearByEmail($sEmail); if (\RainLoop\Api::Actions()->AddressBookProvider() && \RainLoop\Api::Actions()->AddressBookProvider()->IsActive()) { \RainLoop\Api::Actions()->AddressBookProvider()->DeleteAllContactsAndTags($sEmail); } return true; } return false; }