本文整理汇总了PHP中kuserPeer::userLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::userLogin方法的具体用法?PHP kuserPeer::userLogin怎么用?PHP kuserPeer::userLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::userLogin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginImpl
/**
* Get a session using user email and password
*
* @param string $puserId
* @param string $loginEmail
* @param string $password
* @param int $partnerId
* @param int $expiry
* @param string $privileges
*
* @return string KS
*
* @throws KalturaErrors::USER_NOT_FOUND
* @thrown KalturaErrors::LOGIN_RETRIES_EXCEEDED
* @thrown KalturaErrors::LOGIN_BLOCKED
* @thrown KalturaErrors::PASSWORD_EXPIRED
* @thrown KalturaErrors::INVALID_PARTNER_ID
* @thrown KalturaErrors::INTERNAL_SERVERL_ERROR
* @throws KalturaErrors::USER_IS_BLOCKED
*/
protected function loginImpl($puserId, $loginEmail, $password, $partnerId = null, $expiry = 86400, $privileges = '*')
{
KalturaResponseCacher::disableCache();
myPartnerUtils::resetPartnerFilter('kuser');
kuserPeer::setUseCriteriaFilter(true);
// if a KS of a specific partner is used, don't allow logging in to a different partner
if ($this->getPartnerId() && $partnerId && $this->getPartnerId() != $partnerId) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $partnerId);
}
if ($loginEmail && !$partnerId) {
$this->validateApiAccessControlByEmail($loginEmail);
}
try {
if ($loginEmail) {
$user = UserLoginDataPeer::userLoginByEmail($loginEmail, $password, $partnerId);
} else {
$user = kuserPeer::userLogin($puserId, $password, $partnerId);
}
} catch (kUserException $e) {
$code = $e->getCode();
if ($code == kUserException::LOGIN_DATA_NOT_FOUND) {
throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
}
if ($code == kUserException::USER_NOT_FOUND) {
throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
} else {
if ($code == kUserException::LOGIN_RETRIES_EXCEEDED) {
throw new KalturaAPIException(KalturaErrors::LOGIN_RETRIES_EXCEEDED);
} else {
if ($code == kUserException::LOGIN_BLOCKED) {
throw new KalturaAPIException(KalturaErrors::LOGIN_BLOCKED);
} else {
if ($code == kUserException::PASSWORD_EXPIRED) {
throw new KalturaAPIException(KalturaErrors::PASSWORD_EXPIRED);
} else {
if ($code == kUserException::WRONG_PASSWORD) {
throw new KalturaAPIException(KalturaErrors::USER_WRONG_PASSWORD);
} else {
if ($code == kUserException::USER_IS_BLOCKED) {
throw new KalturaAPIException(KalturaErrors::USER_IS_BLOCKED);
}
}
}
}
}
}
throw new $e();
}
if (!$user) {
throw new KalturaAPIException(KalturaErrors::LOGIN_DATA_NOT_FOUND);
}
if ($partnerId && $user->getPartnerId() != $partnerId || $this->getPartnerId() && !$partnerId && $user->getPartnerId() != $this->getPartnerId()) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $partnerId);
}
$partner = PartnerPeer::retrieveByPK($user->getPartnerId());
if (!$partner || $partner->getStatus() == Partner::PARTNER_STATUS_FULL_BLOCK) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $user->getPartnerId());
}
$ks = null;
$admin = $user->getIsAdmin() ? KalturaSessionType::ADMIN : KalturaSessionType::USER;
// create a ks for this admin_kuser as if entered the admin_secret using the API
kSessionUtils::createKSessionNoValidations($partner->getId(), $user->getPuserId(), $ks, $expiry, $admin, "", $privileges);
return $ks;
}