本文整理汇总了PHP中PermissionPeer::isValidForPartner方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionPeer::isValidForPartner方法的具体用法?PHP PermissionPeer::isValidForPartner怎么用?PHP PermissionPeer::isValidForPartner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionPeer
的用法示例。
在下文中一共展示了PermissionPeer::isValidForPartner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addParseCaptionAssetJob
/**
* @param CaptionAsset $captionAsset
* @param BatchJob $parentJob
* @throws kCoreException FILE_NOT_FOUND
* @return BatchJob
*/
public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
{
$syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
if (!$fileSync) {
if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
if (!$fileSync) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
$fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
}
kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
}
$jobData = new kParseCaptionAssetJobData();
$jobData->setCaptionAssetId($captionAsset->getId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild();
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($captionAsset->getEntryId());
$batchJob->setPartnerId($captionAsset->getPartnerId());
}
return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:kCaptionSearchFlowManager.php
示例2: addAction
/**
* Add entry
*
* @action add
* @param KalturaMediaEntry $entry
* @return KalturaMediaEntry
*/
function addAction(KalturaMediaEntry $entry)
{
if ($entry->conversionQuality && !$entry->conversionProfileId) {
$entry->conversionProfileId = $entry->conversionQuality;
}
$dbEntry = parent::add($entry, $entry->conversionProfileId);
$entryStatus = entryStatus::NO_CONTENT;
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_DRAFT_ENTRY_CONV_PROF_SELECTION, $dbEntry->getPartnerId())) {
$entryConversionProfileHasFlavors = myPartnerUtils::entryConversionProfileHasFlavors($dbEntry->getId());
if (!$entryConversionProfileHasFlavors) {
// If the entry's conversion profile dones't contain any flavors, mark the entry as READY
$entryStatus = entryStatus::READY;
}
}
$dbEntry->setStatus($entryStatus);
$dbEntry->save();
$trackEntry = new TrackEntry();
$trackEntry->setEntryId($dbEntry->getId());
$trackEntry->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
$trackEntry->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA");
TrackEntry::addTrackEntry($trackEntry);
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $dbEntry->getPartnerId(), null, null, null, $dbEntry->getId());
$entry->fromObject($dbEntry, $this->getResponseProfile());
return $entry;
}
示例3: initService
public function initService($serviceId, $serviceName, $actionName)
{
parent::initService($serviceId, $serviceName, $actionName);
if ($this->getPartnerId() > 0 && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_LIVE_CHANNEL, $this->getPartnerId())) {
throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
}
}
示例4: initService
public function initService($serviceId, $serviceName, $actionName)
{
parent::initService($serviceId, $serviceName, $actionName);
$this->applyPartnerFilterForClass('LiveChannelSegment');
if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_LIVE_CHANNEL, $this->getPartnerId())) {
throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName);
}
}
示例5: validateForResponseProfile
public function validateForResponseProfile()
{
if (kEntitlementUtils::getEntitlementEnforcement()) {
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) {
KalturaResponseProfileCacher::useUserCache();
return;
}
throw new KalturaAPIException(KalturaErrors::CANNOT_LIST_RELATED_ENTITLED_WHEN_ENTITLEMENT_IS_ENABLE, get_class($this));
}
}
示例6: hasPermissionToCopyToEntry
/**
* @param entry $entry
* @return bool true if cuepoints should be copied to given entry
*/
public function hasPermissionToCopyToEntry(entry $entry)
{
if (!$entry->getIsTemporary() && PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::COPY_ANNOTATIONS_TO_CLIP, $entry->getPartnerId())) {
return true;
}
if ($entry->getIsTemporary() && !PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::DO_NOT_COPY_ANNOTATIONS_TO_TRIMMED_ENTRY, $entry->getPartnerId())) {
return true;
}
return false;
}
示例7: renderEntry
public function renderEntry($entry)
{
if (!$entry instanceof entry) {
return "";
}
$entry_id = $entry->getId();
$kaltura_elements = "<kaltura:entryId>" . $entry->getId() . "</kaltura:entryId>";
if (isset(kCurrentContext::$partner_id) && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_HIDE_SENSITIVE_DATA_IN_RSS_FEED, kCurrentContext::$partner_id)) {
$kaltura_elements .= "<kaltura:views>" . ($entry->getViews() ? $entry->getViews() : "0") . "</kaltura:views>" . "<kaltura:plays>" . ($entry->getPlays() ? $entry->getPlays() : "0") . "</kaltura:plays>" . "<kaltura:userScreenName>" . $entry->getUserScreenName() . "</kaltura:userScreenName>" . "<kaltura:puserId>" . $entry->getPuserId() . "</kaltura:puserId>" . "<kaltura:userLandingPage>" . $entry->getUserLandingPage() . "</kaltura:userLandingPage>";
} else {
$kaltura_elements .= "<kaltura:views>0</kaltura:views>" . "<kaltura:plays>0</kaltura:plays>" . "<kaltura:userScreenName></kaltura:userScreenName>" . "<kaltura:puserId></kaltura:puserId>" . "<kaltura:userLandingPage></kaltura:userLandingPage>";
}
$kaltura_elements .= "<kaltura:partnerLandingPage>" . $entry->getPartnerLandingPage() . "</kaltura:partnerLandingPage>" . "<kaltura:tags>" . $entry->getTags() . "</kaltura:tags>" . "<kaltura:adminTags>" . $entry->getAdminTags() . "</kaltura:adminTags>" . "<kaltura:votes>" . ($entry->getVotes() ? $entry->getVotes() : "0") . "</kaltura:votes>" . "<kaltura:rank>" . ($entry->getRank() ? $entry->getRank() : "0") . "</kaltura:rank>" . "<kaltura:createdAt>" . $entry->getCreatedAt() . "</kaltura:createdAt>" . "<kaltura:createdAtInt>" . $entry->getCreatedAt(null) . "</kaltura:createdAtInt>" . "<kaltura:sourceLink>" . $entry->getSourceLink() . "</kaltura:sourceLink>" . "<kaltura:credit>" . $entry->getCredit() . "</kaltura:credit>";
if ($this->type == self::TYPE_TABOOLA) {
// TODO - use entry->getDisplayScope();
$taboola_elements = $entry->getDisplayInSearch() >= 2 ? "<tv:label>_KN_</tv:label>" . "<tv:uploader>" . $entry->getPartnerId() . "</tv:uploader>" : '';
} else {
$taboola_elements = "";
}
// for now the partner_id & entry_id are set in the guid elementy of the item..
// TODO - move the partner_id to be part of the primary key of the entry so entry will not appear in wrong partners
$mrss = '<item>' . '<description>Kaltura Item</description>' . '<guid isPermaLink="false">' . $entry->getPartnerId() . "|" . $entry_id . '</guid>' . '<link>' . $entry->getPartnerLandingPage() . '</link>' . '<pubDate>' . $entry->getCreatedAt() . '</pubDate>' . '<media:content ' . 'url="' . $entry->getDataUrl() . '/ext/flv" ' . ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO ? 'type="video/x-flv" ' : ' ') . 'medium="' . $entry->getTypeAsString() . '" ' . 'duration="' . (int) ($entry->getLengthInMsecs() / 1000) . '" ' . 'lang="en"' . '/> ' . '<media:title type="plain">' . kString::xmlEncode($entry->getName()) . "</media:title>" . '<media:description>' . kString::xmlEncode($entry->getDescription()) . '</media:description>' . '<media:keywords>' . kString::xmlEncode($entry->getSearchText()) . '</media:keywords>' . '<media:thumbnail url="' . $entry->getThumbnailUrl() . '/width/640/height/480"/>' . '<media:credit role="kaltura partner">' . $entry->getPartnerId() . '</media:credit>' . $kaltura_elements . $taboola_elements . '</item>';
return $mrss;
}
示例8: validateForResponseProfile
public function validateForResponseProfile()
{
if (!kCurrentContext::$is_admin_session && !$this->idEqual && !$this->idIn && !$this->systemNameEqual && !$this->systemNameIn && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) {
throw new KalturaAPIException(KalturaCuePointErrors::USER_KS_CANNOT_LIST_RELATED_CUE_POINTS, get_class($this));
}
}
示例9: invalidateCachedRelatedObjects
protected function invalidateCachedRelatedObjects(IRelatedObject $object)
{
self::invalidateRelated($object);
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_RECALCULATE_RESPONSE_PROFILE_CACHE, $object->getPartnerId())) {
$this->addRecalculateRelatedObjectsCacheJob($object);
}
return true;
}
示例10: getExternalFileSyncForKeyByStatus
/**
* Get the external FileSync object by its key and statuses
*
* @param FileSyncKey $key
* @param int $externalStorageId
* @param array $statuses an array of required status values
* @return FileSync
*/
protected static function getExternalFileSyncForKeyByStatus(FileSyncKey $key, $externalStorageId = null, $statuses = array())
{
if (is_null($key->partner_id)) {
throw new kFileSyncException("partner id not defined for key [{$key}]", kFileSyncException::FILE_SYNC_PARTNER_ID_NOT_DEFINED);
}
self::prepareStorageProfilesForSort($key->partner_id);
$c = new Criteria();
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
if (is_null($externalStorageId)) {
$c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
// any external
$c->addAnd(FileSyncPeer::DC, self::$storageProfilesOrder, Criteria::IN);
} else {
$c->addAnd(FileSyncPeer::DC, $externalStorageId);
}
if (!empty($statuses)) {
$c->addAnd(FileSyncPeer::STATUS, $statuses, Criteria::IN);
}
if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_DELIVERY_PRIORITY, $key->partner_id)) {
return FileSyncPeer::doSelectOne($c);
}
$fileSyncs = FileSyncPeer::doSelect($c);
if (count($fileSyncs) > 1) {
uasort($fileSyncs, array('self', 'compareStorageProfiles'));
}
return reset($fileSyncs);
}
示例11: isPartnerPermittedForCopy
/**
*
* @param Partner $toPartner
* @param array $permissionArray
*
* @return bool
*/
public static function isPartnerPermittedForCopy(Partner $toPartner, array $permissionArray)
{
foreach ($permissionArray as $permission) {
if (!PermissionPeer::isValidForPartner($permission, $toPartner->getId())) {
return false;
}
}
return true;
}
示例12: getPassResetLink
public static function getPassResetLink($hashKey)
{
if (!$hashKey) {
return null;
}
$loginData = self::isHashKeyValid($hashKey);
if (!$loginData) {
throw new Exception('Hash key not valid');
}
$resetLinksArray = kConf::get('password_reset_links');
$resetLinkPrefix = $resetLinksArray['default'];
$partnerId = $loginData->getConfigPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if ($partner) {
// partner may define a custom reset password url (admin console for example)
$urlPrefixName = $partner->getPassResetUrlPrefixName();
if ($urlPrefixName && isset($resetLinksArray[$urlPrefixName])) {
$resetLinkPrefix = $resetLinksArray[$urlPrefixName];
}
}
$httpsEnforcePermission = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ENFORCE_HTTPS, $partnerId);
if (strpos($resetLinkPrefix, infraRequestUtils::PROTOCOL_HTTPS) === false && $httpsEnforcePermission) {
$resetLinkPrefix = str_replace(infraRequestUtils::PROTOCOL_HTTP, infraRequestUtils::PROTOCOL_HTTPS, $resetLinkPrefix);
}
return $resetLinkPrefix . $hashKey;
}
示例13: filterSelectResults
/**
* Override in order to filter objects returned from doSelect.
*
* @param array $selectResults The array of objects to filter.
* @param Criteria $criteria
*/
public static function filterSelectResults(&$selectResults, Criteria $criteria)
{
if (empty($selectResults)) {
return;
}
$partnerId = kCurrentContext::getCurrentPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if ($partner && $partner->getShouldApplyAccessControlOnEntryMetadata() && !kCurrentContext::$is_admin_session) {
if (is_null(self::$accessControlScope)) {
self::$accessControlScope = new accessControlScope();
self::$accessControlScope->setContexts(array(ContextType::METADATA));
}
$selectResults = array_filter($selectResults, array('entryPeer', 'filterByAccessControl'));
if ($criteria instanceof KalturaCriteria) {
$criteria->setRecordsCount(count($selectResults));
}
}
$removedRecordsCount = 0;
if (!kEntitlementUtils::getEntitlementEnforcement() && !is_null(kCurrentContext::$ks) || !self::$filerResults || !kEntitlementUtils::getInitialized()) {
// if initEntitlement hasn't run - skip filters.
return parent::filterSelectResults($selectResults, $criteria);
}
if (is_null(kCurrentContext::$ks) && count($selectResults)) {
$entry = $selectResults[0];
$partner = $entry->getPartner();
if (!$partner) {
throw new kCoreException('entry partner not found');
}
if (!$partner->getDefaultEntitlementEnforcement() || !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partner->getId())) {
return parent::filterSelectResults($selectResults, $criteria);
}
}
foreach ($selectResults as $key => $entry) {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
unset($selectResults[$key]);
$removedRecordsCount++;
}
}
if ($criteria instanceof KalturaCriteria) {
$recordsCount = $criteria->getRecordsCount();
$criteria->setRecordsCount($recordsCount - $removedRecordsCount);
}
self::$filerResults = false;
parent::filterSelectResults($selectResults, $criteria);
}
示例14: fileSyncDelete
/**
* @param FileSync $fileSync
*/
protected function fileSyncDelete(FileSync $fileSync, BatchJob $raisedJob = null)
{
$partnerId = $fileSync->getPartnerId();
$purgePermission = PermissionPeer::isValidForPartner('PURGE_FILES_ON_DELETE', $partnerId);
if ($purgePermission) {
$syncKey = kFileSyncUtils::getKeyForFileSync($fileSync);
kJobsManager::addDeleteFileJob($raisedJob, null, $partnerId, $syncKey, $fileSync->getFullPath(), $fileSync->getDc());
}
}
示例15: writeBulkUploadLogFile
/**
* Returns the log file for bulk upload job
* @param BatchJob $batchJob bulk upload batchjob
*/
public static function writeBulkUploadLogFile($batchJob)
{
if ($batchJob->getJobSubType() && $batchJob->getJobSubType() != self::getBulkUploadTypeCoreValue(BulkUploadCsvType::CSV)) {
return;
}
header("Content-Type: text/plain; charset=UTF-8");
$criteria = new Criteria();
$criteria->add(BulkUploadResultPeer::BULK_UPLOAD_JOB_ID, $batchJob->getId());
$criteria->addAscendingOrderByColumn(BulkUploadResultPeer::LINE_INDEX);
$criteria->setLimit(100);
$bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
if (!count($bulkUploadResults)) {
die("Log file is not ready");
}
$STDOUT = fopen('php://output', 'w');
$data = $batchJob->getData();
/* @var $data kBulkUploadJobData */
//Add header row to the output CSV only if partner level permission for it exists
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
if (PermissionPeer::isValidForPartner(self::FEATURE_CSV_HEADER_ROW, $partnerId)) {
$headerRow = $data->getColumns();
$headerRow[] = "resultStatus";
$headerRow[] = "objectId";
$headerRow[] = "objectStatus";
$headerRow[] = "errorDescription";
fputcsv($STDOUT, $headerRow);
}
$handledResults = 0;
while (count($bulkUploadResults)) {
$handledResults += count($bulkUploadResults);
foreach ($bulkUploadResults as $bulkUploadResult) {
/* @var $bulkUploadResult BulkUploadResult */
$values = str_getcsv($bulkUploadResult->getRowData());
// switch ($bulkUploadResult->getObjectType())
// {
// case BulkUploadObjectType::ENTRY:
// $values = self::writeEntryBulkUploadResults($bulkUploadResult, $data);
// break;
// case BulkUploadObjectType::CATEGORY:
// $values = self::writeCategoryBulkUploadResults($bulkUploadResult, $data);
// break;
// case BulkUploadObjectType::CATEGORY_USER:
// $values = self::writeCategoryUserBulkUploadResults($bulkUploadResult, $data);
// break;
// case BulkUploadObjectType::USER:
// $values = self::writeUserBulkUploadResults($bulkUploadResult, $data);
// break;
// default:
//
// break;
// }
$values[] = $bulkUploadResult->getStatus();
$values[] = $bulkUploadResult->getObjectId();
$values[] = $bulkUploadResult->getObjectStatus();
$values[] = preg_replace('/[\\n\\r\\t]/', ' ', $bulkUploadResult->getErrorDescription());
fputcsv($STDOUT, $values);
}
if (count($bulkUploadResults) < $criteria->getLimit()) {
break;
}
kMemoryManager::clearMemory();
$criteria->setOffset($handledResults);
$bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
}
fclose($STDOUT);
kFile::closeDbConnections();
exit;
}