当前位置: 首页>>代码示例>>PHP>>正文


PHP kuserPeer::userLogin方法代码示例

本文整理汇总了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;
 }
开发者ID:DBezemer,项目名称:server,代码行数:84,代码来源:KalturaBaseUserService.php


注:本文中的kuserPeer::userLogin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。