Пример #1
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     $ks = kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null;
     if ($actionName == 'search' && (!$ks || !$ks->isAdmin() && !$ks->verifyPrivileges(ks::PRIVILEGE_LIST, ks::PRIVILEGE_WILDCARD))) {
         KalturaCriterion::enableTag(KalturaCriterion::TAG_WIDGET_SESSION);
         entryPeer::setUserContentOnly(true);
     }
     parent::initService($serviceId, $serviceName, $actionName);
     if ($actionName != 'parse') {
         $this->applyPartnerFilterForClass('asset');
         $this->applyPartnerFilterForClass('CaptionAssetItem');
     }
     if (!CaptionSearchPlugin::isAllowedPartner($this->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, CaptionSearchPlugin::PLUGIN_NAME);
     }
 }
Пример #2
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     $this->applyPartnerFilterForClass('CuePoint');
     // when session is not admin, allow access to user entries only
     if (!$this->getKs() || !$this->getKs()->isAdmin()) {
         KalturaCriterion::enableTag(KalturaCriterion::TAG_USER_SESSION);
         CuePointPeer::setUserContentOnly(true);
     }
     if (!CuePointPlugin::isAllowedPartner($this->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, CuePointPlugin::PLUGIN_NAME);
     }
     if (!$this->getPartner()->getEnabledService(PermissionName::FEATURE_KALTURA_LIVE_STREAM)) {
         throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, 'Kaltura Live Streams');
     }
 }
Пример #3
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     parent::initService($serviceId, $serviceName, $actionName);
     // Play-Server and Media-Server list entries of all partners
     // This is not too expensive as the requests are cached conditionally and performed on sphinx
     $allowedSystemPartners = array(Partner::MEDIA_SERVER_PARTNER_ID, Partner::PLAY_SERVER_PARTNER_ID);
     if (in_array($this->getPartnerId(), $allowedSystemPartners) && $actionName == 'list') {
         myPartnerUtils::resetPartnerFilter('entry');
     } else {
         $this->applyPartnerFilterForClass('CuePoint');
     }
     // when session is not admin, allow access to user entries only
     if (!$this->getKs() || !$this->getKs()->isAdmin()) {
         KalturaCriterion::enableTag(KalturaCriterion::TAG_USER_SESSION);
         CuePointPeer::setUserContentOnly(true);
     }
     if (!CuePointPlugin::isAllowedPartner($this->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, CuePointPlugin::PLUGIN_NAME);
     }
 }
Пример #4
0
 public function initService($serviceId, $serviceName, $actionName)
 {
     $ks = kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null;
     if (($actionName == 'list' || $actionName == 'count' || $actionName == 'listByReferenceId') && (!$ks || !$ks->isAdmin() && !$ks->verifyPrivileges(ks::PRIVILEGE_LIST, ks::PRIVILEGE_WILDCARD))) {
         KalturaCriterion::enableTag(KalturaCriterion::TAG_WIDGET_SESSION);
         entryPeer::setUserContentOnly(true);
     }
     /*		//to support list categories with entitlmenet for user that is a member of more then 100 large categories
      		//large category is a category with > 10 members or > 100 entries. 				
       		if ($actionName == 'list' && kEntitlementUtils::getEntitlementEnforcement())
     		{
     			$dispatcher = KalturaDispatcher::getInstance();
     			$arguments = $dispatcher->getArguments();
     			
     			$categoriesIds = array();
     			$categories = array();
     			foreach($arguments as $argument)
     			{
     				if ($argument instanceof KalturaBaseEntryFilter)
     				{
     					if(isset($argument->categoriesMatchAnd))
     						$categories = array_merge($categories, explode(',', $argument->categoriesMatchAnd));
     						
     					if(isset($argument->categoriesMatchOr))
     						$categories = array_merge($categories, explode(',', $argument->categoriesMatchOr));
     					
     					if(isset($argument->categoriesFullNameIn))
     						$categories = array_merge($categories, explode(',', $argument->categoriesFullNameIn));
     						
     					if(count($categories))
     					{
     						$categories = categoryPeer::getByFullNamesExactMatch($categories);
     						
     						foreach ($categories as $category)
     							$categoriesIds[] = $category->getId();
     					}
     										
     					if(isset($argument->categoriesIdsMatchAnd))
     						$categoriesIds = array_merge($categoriesIds, explode(',', $argument->categoriesIdsMatchAnd));
     					
     					if(isset($argument->categoriesIdsMatchOr))
     						$categoriesIds = array_merge($categoriesIds, explode(',', $argument->categoriesIdsMatchOr));
     					
     					if(isset($argument->categoryAncestorIdIn))
     						$categoriesIds = array_merge($categoriesIds, explode(',', $argument->categoryAncestorIdIn));
     				}
     			}
     			
     			foreach($categoriesIds as $key => $categoryId)
     			{
     				if(!$categoryId)
     				{
     					unset($categoriesIds[$key]);
     				}
     			}
     			
     			if(count($categoriesIds))
     				entryPeer::setFilterdCategoriesIds($categoriesIds);
     		}*/
     parent::initService($serviceId, $serviceName, $actionName);
     $this->applyPartnerFilterForClass('ConversionProfile');
     $this->applyPartnerFilterForClass('conversionProfile2');
 }
 /**
  * Set Entitlement Enforcement - if entitelement is enabled \ disabled in this session
  * @param int $categoryId
  * @param int $kuser
  * @return bool
  */
 public static function initEntitlementEnforcement($partnerId = null, $enableEntit = null)
 {
     self::$initialized = true;
     if (is_null($partnerId)) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     }
     if (is_null($partnerId)) {
         return;
     }
     $partner = PartnerPeer::retrieveByPK($partnerId);
     if (!$partner) {
         return;
     }
     if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partnerId)) {
         return;
     }
     $partnerDefaultEntitlementEnforcement = $partner->getDefaultEntitlementEnforcement();
     // default entitlement scope is true - enable.
     if (is_null($partnerDefaultEntitlementEnforcement)) {
         $partnerDefaultEntitlementEnforcement = true;
     }
     self::$entitlementEnforcement = $partnerDefaultEntitlementEnforcement;
     $ksString = kCurrentContext::$ks ? kCurrentContext::$ks : '';
     if ($ksString != '') {
         $ks = ks::fromSecureString($ksString);
         $enableEntitlement = $ks->getDisableEntitlement();
         if ($enableEntitlement) {
             self::$entitlementEnforcement = false;
         }
         $enableEntitlement = $ks->getEnableEntitlement();
         if ($enableEntitlement) {
             self::$entitlementEnforcement = true;
         }
     }
     if (!is_null($enableEntit)) {
         if ($enableEntit) {
             self::$entitlementEnforcement = true;
         } else {
             self::$entitlementEnforcement = false;
         }
     }
     if (self::$entitlementEnforcement) {
         KalturaCriterion::enableTag(KalturaCriterion::TAG_ENTITLEMENT_ENTRY);
         KalturaCriterion::enableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
     }
 }