本文整理汇总了PHP中kuserPeer::getKuserByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::getKuserByEmail方法的具体用法?PHP kuserPeer::getKuserByEmail怎么用?PHP kuserPeer::getKuserByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::getKuserByEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAction
/**
* Create a new Partner object
*
* @action register
* @param KalturaPartner $partner
* @param string $cmsPassword
* @param int $templatePartnerId
* @param bool $silent
* @return KalturaPartner
*
* @throws APIErrors::PARTNER_REGISTRATION_ERROR
*/
public function registerAction(KalturaPartner $partner, $cmsPassword = "", $templatePartnerId = null, $silent = false)
{
KalturaResponseCacher::disableCache();
$dbPartner = $partner->toPartner();
$c = new Criteria();
$c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $partner->adminEmail, Criteria::EQUAL);
$existingUser = UserLoginDataPeer::doSelectOne($c);
/*@var $exisitingUser UserLoginData */
try {
if ($cmsPassword == "") {
$cmsPassword = null;
}
$parentPartnerId = null;
if ($this->getKs() && $this->getKs()->isAdmin()) {
$parentPartnerId = $this->getKs()->partner_id;
if ($parentPartnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
$parentPartnerId = null;
} else {
// only if this partner is a var/group, allow setting it as parent for the new created partner
$parentPartner = PartnerPeer::retrieveByPK($parentPartnerId);
if (!($parentPartner->getPartnerGroupType() == PartnerGroupType::VAR_GROUP || $parentPartner->getPartnerGroupType() == PartnerGroupType::GROUP)) {
throw new KalturaAPIException(KalturaErrors::NON_GROUP_PARTNER_ATTEMPTING_TO_ASSIGN_CHILD, $parentPartnerId);
}
if ($templatePartnerId) {
$templatePartner = PartnerPeer::retrieveByPK($templatePartnerId);
if (!$templatePartner || $templatePartner->getPartnerParentId() != $parentPartnerId) {
throw new KalturaAPIException(KalturaErrors::NON_GROUP_PARTNER_ATTEMPTING_TO_ASSIGN_CHILD, $parentPartnerId);
}
}
}
}
$partner_registration = new myPartnerRegistration($parentPartnerId);
$ignorePassword = false;
if ($existingUser && ($this->getKs()->partner_id == Partner::ADMIN_CONSOLE_PARTNER_ID || $this->getKs()->partner_id == $parentPartnerId)) {
kuserPeer::setUseCriteriaFilter(false);
$kuserOfLoginData = kuserPeer::getKuserByEmail($partner->adminEmail, $existingUser->getConfigPartnerId());
kuserPeer::setUseCriteriaFilter(true);
if ($kuserOfLoginData) {
$ignorePassword = true;
}
}
list($pid, $subpid, $pass, $hashKey) = $partner_registration->initNewPartner($dbPartner->getName(), $dbPartner->getAdminName(), $dbPartner->getAdminEmail(), $dbPartner->getCommercialUse(), "yes", $dbPartner->getDescription(), $dbPartner->getUrl1(), $cmsPassword, $dbPartner, $ignorePassword, $templatePartnerId);
$dbPartner = PartnerPeer::retrieveByPK($pid);
// send a confirmation email as well as the result of the service
$partner_registration->sendRegistrationInformationForPartner($dbPartner, false, $existingUser, $silent);
} catch (Exception $ex) {
KalturaLog::CRIT($ex);
// this assumes the partner name is unique - TODO - remove key from DB !
throw new KalturaAPIException(APIErrors::PARTNER_REGISTRATION_ERROR);
}
$partner = new KalturaPartner();
// start from blank
$partner->fromPartner($dbPartner);
$partner->secret = $dbPartner->getSecret();
$partner->adminSecret = $dbPartner->getAdminSecret();
$partner->cmsPassword = $pass;
return $partner;
}
示例2: registerAction
/**
* Register to Kaltura's partner program
*
* @action register
* @param KalturaPartner $partner
* @param string $cmsPassword
* @return KalturaPartner
*
* @throws APIErrors::PARTNER_REGISTRATION_ERROR
*/
function registerAction(KalturaPartner $partner, $cmsPassword = "")
{
KalturaResponseCacher::disableCache();
$dbPartner = $partner->toPartner();
$partner->validatePropertyNotNull("name");
$partner->validatePropertyNotNull("adminName");
$partner->validatePropertyNotNull("adminEmail");
$partner->validatePropertyNotNull("description");
$partner->validatePropertyMaxLength("country", 2, true);
$partner->validatePropertyMaxLength("state", 2, true);
$c = new Criteria();
$c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $partner->adminEmail, Criteria::EQUAL);
$c->setLimit(1);
$existingUser = UserLoginDataPeer::doCount($c) > 0;
try {
if ($cmsPassword == "") {
$cmsPassword = null;
}
$parentPartnerId = null;
if ($this->getKs() && $this->getKs()->isAdmin()) {
$parentPartnerId = $this->getKs()->partner_id;
if ($parentPartnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
$parentPartnerId = null;
} else {
// only if this partner is a var/grou, allow setting it as parent for the new created partner
$parentPartner = PartnerPeer::retrieveByPK($parentPartnerId);
if (!($parentPartner->getPartnerGroupType() == Partner::PARTNER_GROUP_TYPE_VAR || $parentPartner->getPartnerGroupType() == Partner::PARTNER_GROUP_TYPE_GROUP)) {
throw new KalturaAPIException(KalturaErrors::NON_GROUP_PARTNER_ATTEMPTING_TO_ASSIGN_CHILD, $parentPartnerId);
}
}
}
$partner_registration = new myPartnerRegistration($parentPartnerId);
$ignorePassword = false;
if ($existingUser && $this->getKs()->partner_id == Partner::ADMIN_CONSOLE_PARTNER_ID && kuserPeer::getKuserByEmail($partner->adminEmail, Partner::ADMIN_CONSOLE_PARTNER_ID) != null) {
$ignorePassword = true;
}
list($pid, $subpid, $pass, $hashKey) = $partner_registration->initNewPartner($dbPartner->getName(), $dbPartner->getAdminName(), $dbPartner->getAdminEmail(), $dbPartner->getCommercialUse(), "yes", $dbPartner->getDescription(), $dbPartner->getUrl1(), $cmsPassword, $dbPartner, $ignorePassword);
$dbPartner = PartnerPeer::retrieveByPK($pid);
// send a confirmation email as well as the result of the service
$partner_registration->sendRegistrationInformationForPartner($dbPartner, false, $existingUser);
} catch (SignupException $se) {
KalturaLog::INFO($se);
throw new KalturaAPIException(APIErrors::PARTNER_REGISTRATION_ERROR, 'SE ' . $se->getMessage());
} catch (Exception $ex) {
KalturaLog::CRIT($ex);
// this assumes the partner name is unique - TODO - remove key from DB !
throw new KalturaAPIException(APIErrors::PARTNER_REGISTRATION_ERROR, $ex->getMessage());
}
$partner = new KalturaPartner();
// start from blank
$partner->fromPartner($dbPartner);
$partner->secret = $dbPartner->getSecret();
$partner->adminSecret = $dbPartner->getAdminSecret();
$partner->cmsPassword = $pass;
return $partner;
}
示例3: postSave
/**
* Code to be run after persisting the object
* @param PropelPDO $con
*/
public function postSave(PropelPDO $con = null)
{
// update plugin permissions in the database
if (is_array($this->setEnabledPlugins)) {
foreach ($this->setEnabledPlugins as $pluginName => $enabled) {
if ($enabled) {
PermissionPeer::enablePlugin($pluginName, $this->getId());
} else {
PermissionPeer::disablePlugin($pluginName, $this->getId());
}
}
}
// update special services permissions in the database
if (is_array($this->setEnabledServices)) {
foreach ($this->setEnabledServices as $permissionName => $enabled) {
if ($enabled) {
PermissionPeer::enableForPartner($permissionName, PermissionType::SPECIAL_FEATURE, $this->getId());
} else {
PermissionPeer::disableForPartner($permissionName, $this->getId());
}
}
}
$this->setEnabledPlugins = array();
$this->setEnabledServices = array();
$ksObj = kSessionUtils::crackKs(kCurrentContext::$ks);
$currentKuser = null;
if (is_object($ksObj)) {
$currentKuser = kuserPeer::getKuserByEmail($ksObj->user, -2);
}
if ($currentKuser) {
$allowedPartners = $currentKuser->getAllowedPartners();
if (isset($allowedPartners) && !empty($allowedPartners)) {
$partnersArray = array_map('trim', explode(',', $allowedPartners));
if (!in_array($this->getId(), $partnersArray)) {
$currentKuser->setAllowedPartners($allowedPartners . ',' . $this->getId());
}
} else {
$currentKuser->setAllowedPartners($this->getId());
}
$currentKuser->save();
}
}