/**
  * @param KalturaFilterPager $pager
  * @param KalturaDetachedResponseProfile $responseProfile
  * @return KalturaListResponse
  */
 public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $response = new KalturaUserEntryListResponse();
     if (in_array(kCurrentContext::getCurrentSessionType(), array(kSessionBase::SESSION_TYPE_NONE, kSessionBase::SESSION_TYPE_WIDGET))) {
         $response->totalCount = 0;
         return $response;
     }
     $c = new Criteria();
     if (!is_null($this->userIdEqualCurrent) && $this->userIdEqualCurrent) {
         $this->userIdEqual = kCurrentContext::getCurrentKsKuserId();
     } else {
         $this->fixFilterUserId();
     }
     $userEntryFilter = $this->toObject();
     $userEntryFilter->attachToCriteria($c);
     $pager->attachToCriteria($c);
     $list = UserEntryPeer::doSelect($c);
     $resultCount = count($list);
     if ($resultCount && $resultCount < $pager->pageSize) {
         $totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
     } else {
         KalturaFilterPager::detachFromCriteria($c);
         $totalCount = UserEntryPeer::doCount($c);
     }
     $response->totalCount = $totalCount;
     $response->objects = KalturaUserEntryArray::fromDbArray($list, $responseProfile);
     return $response;
 }
 private static function getObjectTypeCacheKey(IRelatedObject $object)
 {
     $userRoles = kPermissionManager::getCurrentRoleIds();
     sort($userRoles);
     $objectType = get_class($object);
     $partnerId = self::$cachedObject->getPartnerId();
     $profileKey = self::$responseProfileKey;
     $protocol = infraRequestUtils::getProtocol();
     $ksType = kCurrentContext::getCurrentSessionType();
     $userRoles = implode('-', $userRoles);
     $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     return "relate_rp{$profileKey}_p{$partnerId}_o{$objectType}_h{$protocol}_k{$ksType}_u{$userRoles}_w{$host}";
 }
Example #3
0
 public function doFromObject($sourceObject, KalturaDetachedResponseProfile $responseProfile = null)
 {
     if (!$sourceObject) {
         return;
     }
     entryPeer::addValidatedEntry($sourceObject->getId());
     parent::doFromObject($sourceObject, $responseProfile);
     $partnerId = kCurrentContext::$ks_partner_id ? kCurrentContext::$ks_partner_id : kCurrentContext::$partner_id;
     if (implode(',', kEntitlementUtils::getKsPrivacyContext()) != kEntitlementUtils::DEFAULT_CONTEXT . $partnerId) {
         $this->categories = null;
         $this->categoriesIds = null;
     }
     if (!kConf::hasParam('protect_userid_in_api') || !in_array($sourceObject->getPartnerId(), kConf::get('protect_userid_in_api')) || !in_array(kCurrentContext::getCurrentSessionType(), array(kSessionBase::SESSION_TYPE_NONE, kSessionBase::SESSION_TYPE_WIDGET))) {
         if ($this->shouldGet('userId', $responseProfile)) {
             $this->userId = $sourceObject->getPuserId();
         }
         if ($this->shouldGet('creatorId', $responseProfile)) {
             $this->creatorId = $sourceObject->getCreatorPuserId();
         }
     }
 }
 protected static function getSessionKey($protocol = null, $ksType = null, array $userRoles = null, $host = null)
 {
     if (!$protocol) {
         $protocol = infraRequestUtils::getProtocol();
     }
     if (!$ksType) {
         $ksType = kCurrentContext::getCurrentSessionType();
     }
     if (!$userRoles) {
         $userRoles = kPermissionManager::getCurrentRoleIds();
     }
     if (!$host) {
         $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     }
     sort($userRoles);
     $userRole = implode('-', $userRoles);
     return "{$protocol}_{$ksType}_{$host}_{$userRole}";
 }
Example #5
0
 public function doFromObject($dbCuePoint, KalturaDetachedResponseProfile $responseProfile = null)
 {
     parent::doFromObject($dbCuePoint, $responseProfile);
     if ($this->shouldGet('userId', $responseProfile)) {
         if ($dbCuePoint->getKuserId() !== null) {
             $dbKuser = kuserPeer::retrieveByPK($dbCuePoint->getKuserId());
             if ($dbKuser) {
                 if (!kConf::hasParam('protect_userid_in_api') || !in_array($dbCuePoint->getPartnerId(), kConf::get('protect_userid_in_api')) || !in_array(kCurrentContext::getCurrentSessionType(), array(kSessionBase::SESSION_TYPE_NONE, kSessionBase::SESSION_TYPE_WIDGET))) {
                     $this->userId = $dbKuser->getPuserId();
                 }
             }
         }
     }
 }