Ejemplo n.º 1
0
 public function validateForUpdate($sourceObject, $propertiesToSkip = array())
 {
     if (!WidevinePlugin::isAllowedPartner(kCurrentContext::getCurrentPartnerId()) || !WidevinePlugin::isAllowedPartner($sourceObject->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::PERMISSION_NOT_FOUND, 'Permission not found to use the Widevine feature.');
     }
     return parent::validateForUpdate($sourceObject, $propertiesToSkip);
 }
 public function toObject($object = null, $skip = array())
 {
     if (is_null($object)) {
         $object = new WidevineFlavorParamsOutput();
     }
     parent::toObject($object, $skip);
     $object->setType(WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR));
     return $object;
 }
Ejemplo n.º 3
0
 private function validateLicenseRequest($flavorAssetId, $wvAssetId, $referrer64base)
 {
     if (!$flavorAssetId) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::FLAVOR_ASSET_ID_CANNOT_BE_NULL);
     }
     $flavorAsset = $this->getFlavorAssetObject($flavorAssetId);
     if ($flavorAsset->getType() != WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR)) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::WRONG_ASSET_TYPE);
     }
     if ($wvAssetId != $flavorAsset->getWidevineAssetId()) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::FLAVOR_ASSET_ID_DONT_MATCH_WIDEVINE_ASSET_ID);
     }
     $entry = entryPeer::retrieveByPK($flavorAsset->getEntryId());
     if (!$entry) {
         throw new KalturaWidevineLicenseProxyException(KalturaWidevineErrorCodes::FLAVOR_ASSET_ID_NOT_FOUND);
     }
     $this->validateAccessControl($entry, $flavorAsset, $referrer64base);
 }
Ejemplo n.º 4
0
 private function hasWidevineFlavorAssetsWithSameWvAssetIdInOtherEntries($wvAssetId, $entryId)
 {
     $entryFilter = new entryFilter();
     $entryFilter->fields['_like_plugins_data'] = WidevinePlugin::getWidevineAssetIdSearchData($wvAssetId);
     $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE);
     $c = KalturaCriteria::create(entryPeer::OM_CLASS);
     $entryFilter->attachToCriteria($c);
     $c->add(entryPeer::ID, $entryId, Criteria::NOT_EQUAL);
     $c->applyFilters();
     $entriesCount = $c->getRecordsCount();
     if ($entriesCount) {
         KalturaLog::debug('Found active flavors for WV asset id [' . $wvAssetId . ']');
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
 /**
  * Applies default values to this object.
  * This method should be called from the object's constructor (or
  * equivalent initialization method).
  * @see        __construct()
  */
 public function applyDefaultValues()
 {
     parent::applyDefaultValues();
     $this->type = WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR);
 }
Ejemplo n.º 6
0
 public static function getExtendedTypes($baseClass, $enumValue)
 {
     $supportedBaseClasses = array(assetPeer::OM_CLASS, assetParamsPeer::OM_CLASS, assetParamsOutputPeer::OM_CLASS);
     if (in_array($baseClass, $supportedBaseClasses) && $enumValue == assetType::FLAVOR) {
         return array(WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR));
     }
     return null;
 }
 public static function dependsOn()
 {
     $bulkUploadXmlDependency = new KalturaDependency(self::BULK_UPLOAD_XML_PLUGIN_NAME);
     $widevineDependency = new KalturaDependency(WidevinePlugin::getPluginName());
     return array($bulkUploadXmlDependency, $widevineDependency);
 }
Ejemplo n.º 8
0
 /**
  * @return int
  */
 public function getRegServerHost()
 {
     $host = $this->getFromCustomData(self::CUSTOM_DATA_WIDEVINE_REG_SERVER_HOST);
     if (!$host) {
         $host = WidevinePlugin::getWidevineConfigParam('reg_server_host');
     }
     return $host;
 }
Ejemplo n.º 9
0
 protected static function getLicenseOverrideParams($overrideParamsStr, $isAdmin)
 {
     $overrideParams = array();
     $allParams = explode(',', $overrideParamsStr);
     foreach ($allParams as $param) {
         $exParam = explode(':', $param);
         if (count($exParam) == 2 && array_key_exists($exParam[0], self::$allowedOverrideParams)) {
             $overrideParams[$exParam[0]] = $exParam[1];
         }
     }
     if ($isAdmin) {
         $kmcPolicy = WidevinePlugin::getWidevineConfigParam('kmc_policy');
         if ($kmcPolicy) {
             $overrideParams[self::SETPOLICY] = $kmcPolicy;
         }
     }
     return $overrideParams;
 }