private function getAccessControlScope()
 {
     $accessControlScope = accessControlScope::partialInit();
     if ($this->_referrer) {
         $accessControlScope->setReferrer($this->_referrer);
     }
     $accessControlScope->setKs($this->_ks);
     $accessControlScope->setEntryId($this->_entry->getId());
     return $accessControlScope;
 }
示例#2
0
 /**
  * @action getContextData
  * @param string $entryId
  * @param KalturaEntryContextDataParams $contextDataParams
  * @return KalturaEntryContextDataResult
  */
 public function getContextData($entryId, KalturaEntryContextDataParams $contextDataParams)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $ks = $this->getKs();
     $isAdmin = false;
     if ($ks) {
         $isAdmin = $ks->isAdmin();
     }
     $accessControl = $dbEntry->getAccessControl();
     $result = new KalturaEntryContextDataResult();
     $result->isAdmin = $isAdmin;
     $result->isScheduledNow = $dbEntry->isScheduledNow();
     // defaults
     $result->isSiteRestricted = false;
     $result->isCountryRestricted = false;
     $result->isSessionRestricted = false;
     $result->isIpAddressRestricted = false;
     $result->previewLength = -1;
     if ($accessControl && $accessControl->hasRestrictions()) {
         KalturaResponseCacher::disableCache();
         $accessControlScope = accessControlScope::partialInit();
         $accessControlScope->setReferrer($contextDataParams->referrer);
         $accessControlScope->setKs($this->getKs());
         $accessControlScope->setEntryId($entryId);
         $accessControl->setScope($accessControlScope);
         if ($accessControl->hasSiteRestriction()) {
             $result->isSiteRestricted = !$accessControl->getSiteRestriction()->isValid();
         }
         if ($accessControl->hasCountryRestriction()) {
             $result->isCountryRestricted = !$accessControl->getCountryRestriction()->isValid();
         }
         if ($accessControl->hasSessionRestriction()) {
             $result->isSessionRestricted = !$accessControl->getSessionRestriction()->isValid();
         }
         if ($accessControl->hasPreviewRestriction()) {
             $result->isSessionRestricted = !$accessControl->getPreviewRestriction()->isValid();
             $result->previewLength = $accessControl->getPreviewRestriction()->getPreviewLength();
         }
         if ($accessControl->hasIpAddressRestriction()) {
             $result->isIpAddressRestricted = !$accessControl->getIpAddressRestriction()->isValid();
         }
     }
     return $result;
 }