示例#1
0
 private function validateAccessControl(entry $entry, flavorAsset $flavorAsset, $referrer64base)
 {
     $referrer = base64_decode(str_replace(" ", "+", $referrer64base));
     if (!is_string($referrer)) {
         $referrer = "";
     }
     // base64_decode can return binary data
     $secureEntryHelper = new KSecureEntryHelper($entry, kCurrentContext::$ks, $referrer, ContextType::PLAY);
     if (!$secureEntryHelper->isKsAdmin()) {
         if (!$entry->isScheduledNow()) {
             throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::ENTRY_NOT_SCHEDULED_NOW);
         }
         if ($secureEntryHelper->isEntryInModeration()) {
             throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::ENTRY_MODERATION_ERROR);
         }
     }
     if ($secureEntryHelper->shouldBlock()) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::ACCESS_CONTROL_RESTRICTED);
     }
     if (!$secureEntryHelper->isAssetAllowed($flavorAsset)) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::FLAVOR_ASSET_ID_NOT_FOUND);
     }
 }