/** * Allows you to add a new DrmProfile object * * @action add * @param KalturaDrmProfile $drmProfile * @return KalturaDrmProfile * * @throws KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER * @throws KalturaErrors::INVALID_PARTNER_ID * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL * @throws DrmErrors::ACTIVE_PROVIDER_PROFILE_ALREADY_EXIST */ public function addAction(KalturaDrmProfile $drmProfile) { // check for required parameters $drmProfile->validatePropertyNotNull('name'); $drmProfile->validatePropertyNotNull('status'); $drmProfile->validatePropertyNotNull('provider'); $drmProfile->validatePropertyNotNull('partnerId'); // validate values if (!PartnerPeer::retrieveByPK($drmProfile->partnerId)) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $drmProfile->partnerId); } if (!DrmPlugin::isAllowedPartner($drmProfile->partnerId)) { throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, DrmPlugin::getPluginName(), $drmProfile->partnerId); } $dbDrmProfile = $drmProfile->toInsertableObject(); if (DrmProfilePeer::retrieveByProvider($dbDrmProfile->getProvider())) { throw new KalturaAPIException(DrmErrors::ACTIVE_PROVIDER_PROFILE_ALREADY_EXIST, $drmProfile->provider); } // save in database $dbDrmProfile->save(); // return the saved object $drmProfile = KalturaDrmProfile::getInstanceByType($dbDrmProfile->getProvider()); $drmProfile->fromObject($dbDrmProfile, $this->getResponseProfile()); return $drmProfile; }
public function execute() { $this->forceSystemAuthentication(); myDbHelper::$use_alternative_con = null; $partnerId = $this->getRequestParameter("partnerId", null); $uiConfId = $this->getRequestParameter("uiConfId", null); $page = $this->getRequestParameter("page", 1); if ($partnerId !== null && $partnerId !== "") { $pageSize = 50; $c = new Criteria(); $c->add(widgetPeer::PARTNER_ID, $partnerId); if ($uiConfId) { $c->add(widgetPeer::UI_CONF_ID, $uiConfId); } $c->addDescendingOrderByColumn(widgetPeer::CREATED_AT); $total = widgetPeer::doCount($c); $lastPage = ceil($total / $pageSize); $c->setOffset(($page - 1) * $pageSize); $c->setLimit($pageSize); $widgets = widgetPeer::doSelect($c); } else { $total = 0; $lastPage = 0; $widgets = array(); } $this->uiConfId = $uiConfId; $this->page = $page; $this->lastPage = $lastPage; $this->widgets = $widgets; $this->partner = PartnerPeer::retrieveByPK($partnerId); $this->partnerId = $partnerId; }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $allow_empty = $this->getP("allow_empty_field", false); if ($allow_empty == "false" || $allow_empty === 0) { $allow_empty = false; } $partner = new Partner(); $obj_wrapper = objectWrapperBase::getWrapperClass($partner, 0); $updateable_fields = $obj_wrapper->getUpdateableFields(); // TODO - use fillObjectFromMapOrderedByFields instead $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $partner, "partner_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty); // check that mandatory fields were set // TODO if (count($fields_modified) > 0) { $target_partner = PartnerPeer::retrieveByPK($partner_id); if ($partner && $target_partner) { if (@$fields_modified["adminEmail"] && $target_partner->getAdminEmail() != $fields_modified["adminEmail"]) { myPartnerUtils::emailChangedEmail($partner_id, $target_partner->getAdminEmail(), $fields_modified["adminEmail"], $target_partner->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE); } $partner->setType($target_partner->getType()); baseObjectUtils::fillObjectFromObject($updateable_fields, $partner, $target_partner, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty); $target_partner->save(); $this->addMsg("partner", objectWrapperBase::getWrapperClass($target_partner, objectWrapperBase::DETAIL_LEVEL_DETAILED)); $this->addDebug("added_fields", $fields_modified); } else { $this->addError(APIErrors::UNKNOWN_PARTNER_ID); } } else { $this->addError(APIErrors::NO_FIELDS_SET_FOR_PARTNER); } }
/** * @param BaseObject $object * @return bool */ public static function traceEnabled($partnerId, AuditTrail $auditTrail = null) { if (is_null($partnerId)) { KalturaLog::info("Partner id is null"); return false; } if (!isset(self::$cachedPartnerEnabled[$partnerId])) { $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { KalturaLog::info("Partner not found"); return false; } if (!$partner->getPluginEnabled(AuditPlugin::PLUGIN_NAME)) { KalturaLog::info("Partner audit trail is disabled"); self::$cachedPartnerEnabled[$partnerId] = false; } else { self::$cachedPartnerEnabled[$partnerId] = true; } } // validate only partner if (is_null($auditTrail)) { return self::$cachedPartnerEnabled[$partnerId]; } $auditTrailConfig = self::getAuditTrailConfig($partnerId, $auditTrail->getObjectType()); if (is_null($auditTrailConfig)) { KalturaLog::info("Audit trail config not found"); return false; } return $auditTrailConfig->actionEnabled($auditTrail->getAction()); }
public function myBatchPartnerUsage() { self::initDb(); $partners_exists = true; $start_pos = 0; $bulk_size = 500; while ($partners_exists) { $c = new Criteria(); // get only free partners $c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1); $c->addAnd(PartnerPeer::MONITOR_USAGE, 1); $c->setOffset($start_pos); $c->setLimit($bulk_size); $partners = PartnerPeer::doSelect($c); if (!$partners) { TRACE("No more partners. offset: {$start_pos} , limit: {$bulk_size} ."); $partners_exists = false; } else { TRACE("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} ."); foreach ($partners as $partner) { myPartnerUtils::doPartnerUsage($partner, true); } } unset($partners); $start_pos += $bulk_size; } }
public static function getAssetUrl(asset $asset, $servePlayManifest = false, $playManifestClientTag = null, $storageId = null, $urlParameters = '') { $partner = PartnerPeer::retrieveByPK($asset->getPartnerId()); if (!$partner) { return null; } $syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = self::getExternalStorageUrl($partner, $asset, $syncKey, $servePlayManifest, $playManifestClientTag, $storageId); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } if ($asset instanceof flavorAsset && $servePlayManifest) { $url = requestUtils::getApiCdnHost() . $asset->getPlayManifestUrl($playManifestClientTag, $storageId); } else { $urlManager = DeliveryProfilePeer::getDeliveryProfile($asset->getEntryId()); if ($asset instanceof flavorAsset) { $urlManager->initDeliveryDynamicAttributes(null, $asset); } $profileAttributes = $urlManager->getDynamicAttributes(); $profileAttributes->setUrlParams($urlParameters); $url = $urlManager->getFullAssetUrl($asset); $url = preg_replace('/^https?:\\/\\//', '', $url); $protocol = infraRequestUtils::getProtocol(); $deliveryProfileProtocols = $urlManager->getMediaProtocols(); if (!is_null($deliveryProfileProtocols) && !in_array($protocol, explode(',', $deliveryProfileProtocols))) { $protocol = infraRequestUtils::PROTOCOL_HTTP; } $url = $protocol . "://" . $url; } return $url; }
public function execute() { $ksStr = $this->getP("ks"); if ($ksStr) { $ksObj = null; try { $ksObj = ks::fromSecureString($ksStr); } catch (Exception $e) { } if ($ksObj) { $partner = PartnerPeer::retrieveByPK($ksObj->partner_id); if (!$partner) { KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND); } if (!$partner->validateApiAccessControl()) { KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED); } $ksObj->kill(); } KalturaLog::info("Killing session with ks - [{$ksStr}], decoded - [" . base64_decode($ksStr) . "]"); } else { KalturaLog::err('logoutAction called with no KS'); } setcookie('pid', "", 0, "/"); setcookie('subpid', "", 0, "/"); setcookie('kmcks', "", 0, "/"); return sfView::NONE; //redirection to kmc/kmc is done from java script }
/** * @action listByPartner * @param KalturaPartnerFilter $filter * @param KalturaFilterPager $pager * @return KalturaStorageProfileListResponse */ public function listByPartnerAction(KalturaPartnerFilter $filter = null, KalturaFilterPager $pager = null) { $c = new Criteria(); if (!is_null($filter)) { $partnerFilter = new partnerFilter(); $filter->toObject($partnerFilter); $partnerFilter->set('_gt_id', 0); $partnerCriteria = new Criteria(); $partnerFilter->attachToCriteria($partnerCriteria); $partnerCriteria->setLimit(1000); $partnerCriteria->clearSelectColumns(); $partnerCriteria->addSelectColumn(PartnerPeer::ID); $stmt = PartnerPeer::doSelectStmt($partnerCriteria); if ($stmt->rowCount() < 1000) { $partnerIds = $stmt->fetchAll(PDO::FETCH_COLUMN); $c->add(StorageProfilePeer::PARTNER_ID, $partnerIds, Criteria::IN); } } if (is_null($pager)) { $pager = new KalturaFilterPager(); } $totalCount = StorageProfilePeer::doCount($c); $pager->attachToCriteria($c); $list = StorageProfilePeer::doSelect($c); $newList = KalturaStorageProfileArray::fromStorageProfileArray($list); $response = new KalturaStorageProfileListResponse(); $response->totalCount = $totalCount; $response->objects = $newList; return $response; }
public function execute() { $this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript"); $kshow_id = $this->getRequestParameter('kshow_id', 0); $uid = kuser::ANONYMOUS_PUSER_ID; $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { return sfView::ERROR; } // kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways // lets make sure we pass just the id to the contribution wizard $kshow_id = $kshow->getId(); $partner_id = $kshow->getPartnerId(); $partner = PartnerPeer::retrieveByPK($partner_id); $subp_id = $kshow->getSubpId(); $partner_secret = $partner->getSecret(); $partner_name = $partner->getPartnerName(); $kaltura_services = new startsessionAction(); $kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret)); $result = $kaltura_services->internalExecute(); $this->ks = @$result["result"]["ks"]; $this->widget_host = requestUtils::getHost(); $this->kshow_id = $kshow_id; $this->uid = $uid; $this->partner_id = $partner_id; $this->subp_id = $subp_id; $this->partner_name = $partner_name; return sfView::SUCCESS; }
/** * Add bulk upload job * @param DropFolder $folder * @param DropFolderFile $leadDropFolderFile * @throws Exception */ private function addXMLBulkUploadJob(DropFolder $folder, DropFolderFile $leadDropFolderFile) { /* @var $leadDropFolderFile FeedDropFolderFile */ KalturaLog::info('Adding BulkUpload job'); try { $coreBulkUploadType = BulkUploadXmlPlugin::getBulkUploadTypeCoreValue(BulkUploadXmlType::XML); $objectId = $leadDropFolderFile->getId(); $objectType = DropFolderXmlBulkUploadPlugin::getBatchJobObjectTypeCoreValue(DropFolderBatchJobObjectType::DROP_FOLDER_FILE); $partner = PartnerPeer::retrieveByPK($folder->getPartnerId()); $data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType); /* @var $data kBulkUploadJobData */ $data->setUploadedBy(kDropFolderXmlEventsConsumer::UPLOADED_BY); KalturaLog::info("Feed XML path: " . $leadDropFolderFile->getFeedXmlPath()); $data->setFilePath($leadDropFolderFile->getFeedXmlPath()); $data->setFileName(basename($data->getFilePath()) . '.xml'); $objectData = new kBulkUploadEntryData(); KalturaLog::info('Conversion profile id: ' . $folder->getConversionProfileId()); $objectData->setConversionProfileId($folder->getConversionProfileId()); $data->setObjectData($objectData); $job = kJobsManager::addBulkUploadJob($partner, $data, $coreBulkUploadType, $objectId, $objectType); $this->setFileToProcessing($leadDropFolderFile); return $job; } catch (Exception $e) { KalturaLog::err("Error adding BulkUpload job -" . $e->getMessage()); throw new Exception(DropFolderXmlBulkUploadPlugin::ERROR_ADDING_BULK_UPLOAD_MESSAGE, DropFolderXmlBulkUploadPlugin::getErrorCodeCoreValue(DropFolderXmlBulkUploadErrorCode::ERROR_ADDING_BULK_UPLOAD)); } }
public function objectChanged(BaseObject $object, array $modifiedColumns) { /* @var $object Permission */ $partner = PartnerPeer::retrieveByPK($object->getPartnerId()); $this->partnerPermissionEnabled($partner); return true; }
/** * Allows you to add a new DrmPolicy object * * @action add * @param KalturaDrmPolicy $drmPolicy * @return KalturaDrmPolicy * * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL */ public function addAction(KalturaDrmPolicy $drmPolicy) { // check for required parameters $drmPolicy->validatePropertyNotNull('name'); $drmPolicy->validatePropertyNotNull('status'); $drmPolicy->validatePropertyNotNull('provider'); $drmPolicy->validatePropertyNotNull('systemName'); $drmPolicy->validatePropertyNotNull('scenario'); $drmPolicy->validatePropertyNotNull('partnerId'); // validate values $drmPolicy->validatePolicy(); if (!PartnerPeer::retrieveByPK($drmPolicy->partnerId)) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $drmPolicy->partnerId); } if (!DrmPlugin::isAllowedPartner($drmPolicy->partnerId)) { throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, DrmPlugin::getPluginName(), $drmPolicy->partnerId); } if (DrmPolicyPeer::retrieveBySystemName($drmPolicy->systemName)) { throw new KalturaAPIException(DrmErrors::DRM_POLICY_DUPLICATE_SYSTEM_NAME, $drmPolicy->systemName); } // save in database $dbDrmPolicy = $drmPolicy->toInsertableObject(); $dbDrmPolicy->save(); // return the saved object $drmPolicy = KalturaDrmPolicy::getInstanceByType($dbDrmPolicy->getProvider()); $drmPolicy->fromObject($dbDrmPolicy, $this->getResponseProfile()); return $drmPolicy; }
/** * Add new Syndication Feed * * @action add * @param KalturaBaseSyndicationFeed $syndicationFeed * @return KalturaBaseSyndicationFeed */ public function addAction(KalturaBaseSyndicationFeed $syndicationFeed) { $syndicationFeed->validatePlaylistId(); if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) { $syndicationFeed->validateXslt(); $syndicationFeedDB = new genericSyndicationFeed(); $syndicationFeedDB->setVersion(1); } else { $syndicationFeedDB = new syndicationFeed(); } $syndicationFeed->partnerId = $this->getPartnerId(); $syndicationFeed->status = KalturaSyndicationFeedStatus::ACTIVE; $syndicationFeed->toObject($syndicationFeedDB); $syndicationFeedDB->save(); if ($syndicationFeed->addToDefaultConversionProfile) { $partner = PartnerPeer::retrieveByPK($this->getPartnerId()); $c = new Criteria(); $c->addAnd(flavorParamsConversionProfilePeer::CONVERSION_PROFILE_ID, $partner->getDefaultConversionProfileId()); $c->addAnd(flavorParamsConversionProfilePeer::FLAVOR_PARAMS_ID, $syndicationFeed->flavorParamId); $is_exist = flavorParamsConversionProfilePeer::doCount($c); if (!$is_exist || $is_exist === 0) { $fpc = new flavorParamsConversionProfile(); $fpc->setConversionProfileId($partner->getDefaultConversionProfileId()); $fpc->setFlavorParamsId($syndicationFeed->flavorParamId); $fpc->save(); } } if ($syndicationFeed instanceof KalturaGenericXsltSyndicationFeed) { $key = $syndicationFeedDB->getSyncKey(genericSyndicationFeed::FILE_SYNC_SYNDICATION_FEED_XSLT); kFileSyncUtils::file_put_contents($key, $syndicationFeed->xslt); } $syndicationFeed->fromObject($syndicationFeedDB); return $syndicationFeed; }
private static function purgeAssetFromEdgeCast(asset $asset) { // get partner $partnerId = $asset->getPartnerId(); $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { KalturaLog::err('Cannot find partner with id [' . $partnerId . ']'); return false; } $mediaType = $asset instanceof thumbAsset ? self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE : self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE; $mediaTypePathList = array(); try { $mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $asset->getDownloadUrl()); // asset download url } catch (Exception $e) { KalturaLog::err('Cannot get asset URL for asset id [' . $asset->getId() . '] - ' . $e->getMessage()); } if ($asset instanceof flavorAsset) { // get a list of all URLs leading to the asset for purging $subPartnerId = $asset->getentry()->getSubpId(); $partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subPartnerId); $assetId = $asset->getId(); $serveFlavorUrl = "{$partnerPath}/serveFlavor/entryId/" . $asset->getEntryId() . "/flavorId/{$assetId}" . '*'; // * wildcard should delete all serveFlavor urls $hosts = array($partner->getCdnHost(), $partner->getRtmpUrl(), $partner->getIisHost()); foreach ($hosts as $host) { if (!empty($host)) { $mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $host . $serveFlavorUrl); } } } return self::purgeFromEdgeCast($mediaTypePathList, $partner); }
public function myBatchPartnerUsage($partnerId = null) { self::initDb(); $partners_exists = true; $start_pos = 0; $bulk_size = 500; while ($partners_exists) { $c = new Criteria(); if (!is_null($partnerId)) { $c->addAnd(PartnerPeer::ID, $partnerId); } $c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1); // get only free partners $c->addAnd(PartnerPeer::MONITOR_USAGE, 1); $c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, CRITERIA::NOT_EQUAL); $c->setOffset($start_pos); $c->setLimit($bulk_size); $partners = PartnerPeer::doSelect($c); if (!$partners) { KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} ."); $partners_exists = false; } else { KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} ."); foreach ($partners as $partner) { myPartnerUtils::doPartnerUsage($partner, true); } } unset($partners); PartnerPeer::clearInstancePool(); $start_pos += $bulk_size; } }
function addPermission($permissionCfg) { // verify obligatory fields if (!$permissionCfg->name) { throw new Exception('Permission name must be set'); } if ((is_null($permissionCfg->partnerId) || $permissionCfg->partnerId === '') && (is_null($permissionCfg->partnerPackages) || $permissionCfg->partnerPackages === '')) { throw new Exception('Permission partner id or partner package must be set'); } if (isset($permissionCfg->partnerId) && $permissionCfg->partnerId != '') { $partnerIds = explode(",", $permissionCfg->partnerId); foreach ($partnerIds as $partnerId) { addPermissionToPartner($permissionCfg, $partnerId); } } if (isset($permissionCfg->partnerPackages) && $permissionCfg->partnerPackages != '') { $countLimitEachLoop = 100; $offset = $countLimitEachLoop; $c = new Criteria(); $c->add(PartnerPeer::ID, 0, Criteria::GREATER_THAN); $c->add(PartnerPeer::PARTNER_PACKAGE, explode(',', $permissionCfg->partnerPackages), Criteria::IN); $c->setLimit($countLimitEachLoop); $partners = PartnerPeer::doSelect($c); while (count($partners)) { foreach ($partners as $partner) { addPermissionToPartner($permissionCfg, $partner->getId()); } $c->setOffset($offset); PartnerPeer::clearInstancePool(); $partners = PartnerPeer::doSelect($c); $offset += $countLimitEachLoop; sleep(1); } } }
/** * Return the notifications for a specific entry id and type * * @action getClientNotification * @param string $entryId * @param KalturaNotificationType $type * @return KalturaClientNotification */ function getClientNotificationAction($entryId, $type) { // in case of a multirequest, a mediaService.addFromUploadedFile may fail and therefore the resulting entry id will be empty // in such a case return immidiately without looking for the notification if ($entryId == '') { throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId); } $notifications = BatchJobPeer::retrieveByEntryIdAndType($entryId, BatchJobType::NOTIFICATION, $type); // FIXME: throw error if not found if (count($notifications) == 0) { throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId); } $notification = $notifications[0]; $partnerId = $this->getPartnerId(); $nofication_config_str = null; list($nofity, $nofication_config_str) = myPartnerUtils::shouldNotify($partnerId); if (!$nofity) { return new KalturaClientNotification(); } $nofication_config = myNotificationsConfig::getInstance($nofication_config_str); $nofity_send_type = $nofication_config->shouldNotify($type); if ($nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_SYNCH && $nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_BOTH) { return new KalturaClientNotification(); } $partner = PartnerPeer::retrieveByPK($partnerId); list($url, $signatureKey) = myNotificationMgr::getPartnerNotificationInfo($partner); list($params, $rawSignature) = myNotificationMgr::prepareNotificationData($url, $signatureKey, $notification, null); $serializedParams = http_build_query($params, "", "&"); $result = new KalturaClientNotification(); $result->url = $url; $result->data = $serializedParams; return $result; }
public static function isAllowedPartner($partnerId) { if (in_array($partnerId, array(Partner::ADMIN_CONSOLE_PARTNER_ID, Partner::BATCH_PARTNER_ID))) { return true; } $partner = PartnerPeer::retrieveByPK($partnerId); return $partner->getPluginEnabled(self::PLUGIN_NAME); }
public function initService($serviceId, $serviceName, $actionName) { parent::initService($serviceId, $serviceName, $actionName); $partner = PartnerPeer::retrieveByPK($this->getPartnerId()); if ($actionName == "anonymousRank" && $partner->getEnabledService(KalturaPermissionName::FEATURE_LIKE)) { throw new KalturaAPIException(KalturaErrors::ACTION_FORBIDDEN, "anonymousRank"); } }
protected function getPartner($partnerId) { $partner = PartnerPeer::retrieveByPK($partnerId); if (is_null($partner)) { throw new Exception('Partner id ' . $partnerId . ' not found'); } return $partner; }
public static function isAllowedPartner($partnerId) { $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { return false; } return $partner->getPluginEnabled(self::PLUGIN_NAME); }
public static function isAllowedPartner($partnerId) { if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) { return true; } $partner = PartnerPeer::retrieveByPK($partnerId); return $partner->getPluginEnabled(ContentDistributionPlugin::getPluginName()); }
public static function isAllowedPartner($partnerId) { $partner = PartnerPeer::retrieveByPK($partnerId); if ($partner) { // check that both the push plugin and the event notification plugin are enabled return $partner->getPluginEnabled(self::PLUGIN_NAME) && EventNotificationPlugin::isAllowedPartner($partnerId); } return false; }
protected function getAdminSessionForPartner($partnerId) { $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { throw new Exception('Partner not found when trying to start session'); } $sessionService = new SessionService(); $sessionService->initService('session', 'session', 'start'); return $sessionService->startAction($partner->getAdminSecret(), "", KalturaSessionType::ADMIN, $partnerId); }
public static function partnerOptions($current_value) { $options[-1] = "All"; $c = new Criteria(); $partners = PartnerPeer::doSelect($c); foreach ($partners as $partner) { $options[$partner->getId()] = $partner->getPartnerName(); } return dashboardUtils::options($current_value, $options); }
public function execute() { $this->forceSystemAuthentication(); $hint = $this->getP("hint"); $search_partnerName = $this->getP("p_partnerName", true); $search_description = $this->getP("p_description", true); $search_url1 = $this->getP("p_url1", true); $search_adminName = $this->getP("p_adminName", true); $search_adminEmail = $this->getP("p_adminEmail", true); $limit = $this->getP("limit", 300); $offset = $this->getP("offset", 0); $text_to_search = "%{$hint}%"; $c = new Criteria(); $crit = $c->getNewCriterion(PartnerPeer::PARTNER_NAME, $text_to_search, Criteria::LIKE); if ($search_description) { $crit->addOr($c->getNewCriterion(PartnerPeer::DESCRIPTION, $text_to_search, Criteria::LIKE)); } if ($search_url1) { $crit->addOr($c->getNewCriterion(PartnerPeer::URL1, $text_to_search, Criteria::LIKE)); } if ($search_adminName) { $crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_NAME, $text_to_search, Criteria::LIKE)); } if ($search_adminEmail) { $crit->addOr($c->getNewCriterion(PartnerPeer::ADMIN_EMAIL, $text_to_search, Criteria::LIKE)); } $c->addAnd($crit); // $this->count = PartnerPeer::doCount( $c ); $c->setLimit($limit); if ($offset > 0) { $c->setOffset($offset); } if ($hint) { $this->partner_list = PartnerPeer::doSelect($c); } else { $this->partner_list = array(); } /* $arr = array(); foreach ( $this->partner_list as $partner ) { $p = array ( "id" => $partner->getId() , "partnerName" => $partner->getPartnerName() , "description" => $partner->getDescription() , "url1" => $partner->getUrl1() , "adminName" => $partner->getAdminName() , "adminEmail" => $partner->getAdminEmail() , ); $arr[] = $p; } */ $this->hint = $hint; // return $this->renderText(json_encode ( $arr ) ); }
/** * @param accessControl $accessControl */ public function __construct(accessControl $accessControl = null) { parent::__construct($accessControl); $contexts = array(accessControlContextType::PLAY, accessControlContextType::DOWNLOAD); $partnerId = $accessControl ? $accessControl->getPartnerId() : kCurrentContext::$ks_partner_id; $partner = PartnerPeer::retrieveByPK($partnerId); if ($partner && $partner->getRestrictThumbnailByKs()) { $contexts[] = accessControlContextType::THUMBNAIL; } $this->setContexts($contexts); }
public static function isAllowedPartner($partnerId) { if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) { return true; } $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { return false; } return $partner->getPluginEnabled(self::PLUGIN_NAME); }
private function __construct($partnerId) { DbManager::setConfig(kConf::getDB()); DbManager::initialize(); $this->confPath = KALTURA_ROOT_PATH . '/configurations/wams/'; $partner = PartnerPeer::retrieveByPK($partnerId); $wams_account_name = $partner->getWamsAccountName(); $wams_access_key = $partner->getWamsAccountKey(); self::testConnection($wams_account_name, $wams_access_key); $this->_mediaServiceProxy = ServicesBuilder::getInstance()->createMediaServicesService(new MediaServicesSettings($wams_account_name, $wams_access_key)); }
public function validateForInsert($propertiesToSkip = array()) { $partnerId = kCurrentContext::getCurrentPartnerId(); $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { throw new KalturaAPIException(KalturaErrors::PARTNER_NOT_FOUND, $partnerId); } if (!$partner->getPluginEnabled(FreewheelGenericDistributionPlugin::DEPENDENTS_ON_PLUGIN_NAME_CUE_POINT)) { throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, FreewheelGenericDistributionPlugin::DEPENDENTS_ON_PLUGIN_NAME_CUE_POINT, $partnerId); } return parent::validateForInsert($propertiesToSkip); }