private function assertKuser() { // check copied values $this->assertEquals($this->adminKuser->getFullName(), $this->kuser->getFullName(), 'full_name for ' . $this->getParams()); $this->assertEquals($this->adminKuser->getIcon(), $this->kuser->getIcon(), 'icon for ' . $this->getParams()); $this->assertEquals('__ADMIN__' . $this->adminKuser->getId(), $this->kuser->getPuserId(), 'puserid for ' . $this->getParams()); $this->assertEquals($this->adminKuser->getPartnerId(), $this->kuser->getPartnerId(), 'partner_id for ' . $this->getParams()); $this->assertEquals($this->adminKuser->getPicture(), $this->kuser->getPicture(), 'picture for ' . $this->getParams()); $this->assertEquals($this->adminKuser->getEmail(), $this->kuser->getEmail(), 'email for ' . $this->getParams()); $this->assertEquals($this->adminKuser->getScreenName(), $this->kuser->getScreenName(), 'screen_name for ' . $this->getParams()); // check new values $this->assertEquals(true, $this->kuser->getIsAdmin(), 'is_admin for ' . $this->getParams()); $this->assertEquals($this->kuser->getLoginDataId(), $this->loginData->getId()); }
private function assertKuser() { // check copied values $this->assertEquals($this->systemUser->getFirstName(), $this->kuser->getFirstName(), 'first_name for ' . $this->getParams()); $this->assertEquals($this->systemUser->getLastName(), $this->kuser->getLastName(), 'last_name for ' . $this->getParams()); $this->assertEquals($this->systemUser->getEmail(), $this->kuser->getPuserId(), 'puserid for ' . $this->getParams()); $this->assertEquals($this->adminConsolePartnerId, $this->kuser->getPartnerId(), 'partner_id for ' . $this->getParams()); $this->assertEquals($this->systemUser->getEmail(), $this->kuser->getEmail(), 'email for ' . $this->getParams()); $this->assertEquals($this->systemUser->getName(), $this->kuser->getScreenName(), 'screen_name for ' . $this->getParams()); $this->assertEquals($this->systemUser->getName(), $this->kuser->getFullName(), 'full_name for ' . $this->getParams()); if ($this->systemUser->getStatus == systemUser::SYSTEM_USER_ACTIVE) { $this->assertEquals(KuserStatus::ACTIVE, $this->kuser->getStatus(), 'status ' . $this->getParams()); } else { $this->assertEquals(KuserStatus::BLOCKED, $this->kuser->getStatus(), 'status ' . $this->getParams()); } $this->assertEquals($this->systemUser->getDeletedAt(), $this->kuser->getDeletedAt(), 'deleted_at ' . $this->getParams()); $partnerData = unserialize($this->kuser->getPartnerData()); var_dump($partnerData); $this->assertTrue(get_class($partnerData) === 'Kaltura_AdminConsoleUserPartnerData', 'PartnerData is not of type Kaltura_AdminConsoleUserPartnerData'); $this->assertEquals($this->systemUser->getIsPrimary(), $partnerData->isPrimary, 'is_primary ' . $this->getParams()); $this->assertEquals($this->systemUser->getRole(), $partnerData->role, 'role ' . $this->getParams()); // check new values $this->assertEquals(true, $this->kuser->getIsAdmin(), 'is_admin for ' . $this->getParams()); $this->assertEquals($this->kuser->getLoginDataId(), $this->loginData->getId()); }
private function sendRegistrationInformation(Partner $partner, kuser $adminKuser, $existingUser, $recipient_email = null, $partner_type = 1) { $mailType = null; $bodyParams = array(); $partnerId = $partner->getId(); $userName = $adminKuser->getFullName(); if (!$userName) { $userName = $adminKuser->getPuserId(); } $loginEmail = $adminKuser->getEmail(); $loginData = $adminKuser->getLoginData(); $hashKey = $loginData->getNewHashKeyIfCurrentInvalid(); $resetPasswordLink = UserLoginDataPeer::getPassResetLink($hashKey); $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc'; $contactLink = kConf::get('contact_url'); $contactPhone = kConf::get('contact_phone_number'); $beginnersGuideLink = kConf::get('beginners_tutorial_url'); $quickStartGuideLink = kConf::get('quick_start_guide_url'); if ($recipient_email == null) { $recipient_email = $loginEmail; } // send the $cms_email,$cms_password, TWICE ! if (kConf::get('kaltura_installation_type') == 'CE') { $partner_type = 1; } switch ($partner_type) { // send different email for different partner types case 1: // KMC signup if ($existingUser) { $mailType = self::KALTURAS_EXISTING_USER_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURAS_CMS_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } break; default: // all others if ($existingUser) { $mailType = self::KALTURAS_DEFAULT_EXISTING_USER_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURAS_DEFAULT_REGISTRATION_CONFIRMATION; $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink); } break; } kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $recipient_email, $bodyParams); }
/** * @dataProvider providerTestMigration */ public function testMigration($kuserId) { $this->assertNull($this->kuser); $this->kuser = kuserPeer::retrieveByPK($kuserId); $this->assertNotNull($this->kuser); $this->assertEquals($this->kuser->getFullName(), trim($this->kuser->getFirstName() . ' ' . $this->kuser->getLastName())); if ($this->kuser->getSalt() && $this->kuser->getSha1Password() && in_array($this->kuser->getPartnerId(), $this->loginPartnerIds)) { $this->assertTrue($this->kuser->getLoginDataId()); $loginData1 = UserLoginDataPeer::retrieveByPK($this->kuser->getLoginDataId()); $this->assertNotNull($loginData1); $loginData2 = UserLoginDataPeer::getByEmail($this->kuser->getEmail()); $this->assertNotNull($loginData2); $this->assertEquals($loginData1->getId(), $loginData2->getId()); $this->assertEquals($this->kuser->getSalt(), $loginData2->getSalt()); $this->assertEquals($this->kuser->getSha1Password(), $loginData2->getSha1Password()); $this->assertEquals($this->kuser->getEmail(), $loginData2->getLoginEmail()); $c = new Criteria(); $c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $this->kuser->getEmail()); $loginDatas = UserLoginDataPeer::doSelect($c); $this->assertEquals(count($loginDatas), 1); $this->assertEquals($loginDatas[0]->getId(), $loginData1->getId()); $allKusers = kuserPeer::getByLoginDataAndPartner($this->kuser->getLoginDataId(), $this->kuser->getPartnerId()); $this->assertEquals(count($allKusers), 1); } else { if ($this->kuser->getPartnerId() != $this->adminConsolePartnerId && substr($this->kuser->getPuserId(), 0, 9) != '__ADMIN__') { $this->assertNull($this->kuser->getLoginDataId()); } } if ($this->kuser->getPartnerId() == $this->adminConsolePartnerId || substr($this->kuser->getPuserId(), 0, 9) == '__ADMIN__') { $this->assertTrue($this->kuser->getIsAdmin()); } else { $this->assertFalse($this->kuser->getIsAdmin()); } if ($this->kuser->getIsAdmin()) { $this->assertTrue($this->kuser->getIsAdmin()); } }
public static function sendNewUserMail(kuser $user, $existingUser) { // setup parameters $partnerId = $user->getPartnerId(); $userName = $user->getFullName(); if (!$userName) { $userName = $user->getPuserId(); } $creatorUserName = '******'; if (!is_null(kCurrentContext::$ks_uid)) { $creatorUser = kuserPeer::getKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid); if ($creatorUser) { $creatorUserName = $creatorUser->getFullName(); } } $publisherName = PartnerPeer::retrieveByPK($partnerId)->getName(); $loginEmail = $user->getEmail(); $roleName = $user->getUserRoleNames(); $puserId = $user->getPuserId(); if (!$existingUser) { $resetPasswordLink = UserLoginDataPeer::getPassResetLink($user->getLoginData()->getPasswordHashKey()); } $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc'; $adminConsoleLink = trim(kConf::get('admin_console_url')); $contactLink = kConf::get('contact_url'); $beginnersGuideLink = kConf::get('beginners_tutorial_url'); $quickStartGuideLink = kConf::get('quick_start_guide_url'); // setup mail $mailType = null; $bodyParams = array(); if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) { if ($existingUser) { $mailType = self::KALTURA_NEW_EXISTING_USER_ADMIN_CONSOLE_EMAIL; $bodyParams = array($userName, $creatorUserName, $loginEmail, $roleName); } else { $mailType = self::KALTURA_NEW_USER_ADMIN_CONSOLE_EMAIL; $bodyParams = array($userName, $creatorUserName, $loginEmail, $resetPasswordLink, $roleName, $adminConsoleLink); } } else { if ($existingUser) { $mailType = self::KALTURA_NEW_EXISTING_USER_EMAIL; $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink); } else { $mailType = self::KALTURA_NEW_USER_EMAIL; $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $resetPasswordLink, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink); } } // add mail job kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $loginEmail, $bodyParams); }