当前位置: 首页>>代码示例>>PHP>>正文


PHP entryPeer::accessControlScope方法代码示例

本文整理汇总了PHP中entryPeer::accessControlScope方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::accessControlScope方法的具体用法?PHP entryPeer::accessControlScope怎么用?PHP entryPeer::accessControlScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entryPeer的用法示例。


在下文中一共展示了entryPeer::accessControlScope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:DBezemer,项目名称:server,代码行数:51,代码来源:entryPeer.php


注:本文中的entryPeer::accessControlScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。