public static function setDefaultCriteriaFilter()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
     $partnerId = kCurrentContext::$ks_partner_id ? kCurrentContext::$ks_partner_id : kCurrentContext::$partner_id;
     if ($partnerId != Partner::BATCH_PARTNER_ID) {
         $c->add(self::STATUS, array(CategoryStatus::DELETED, CategoryStatus::PURGED), Criteria::NOT_IN);
     } else {
         $c->add(self::STATUS, CategoryStatus::PURGED, Criteria::NOT_EQUAL);
     }
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         //add context as filter
         $privacyContextCrit = $c->getNewCriterion(self::PRIVACY_CONTEXTS, kEntitlementUtils::getKsPrivacyContext(), KalturaCriteria::IN_LIKE);
         $privacyContextCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $c->addAnd($privacyContextCrit);
         $crit = $c->getNewCriterion(self::DISPLAY_IN_SEARCH, DisplayInSearchType::PARTNER_ONLY, Criteria::EQUAL);
         $crit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $kuser = null;
         $ksString = kCurrentContext::$ks ? kCurrentContext::$ks : '';
         if ($ksString != '') {
             $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
             $kuser = kuserPeer::getActiveKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid);
         }
         if ($kuser) {
             $membersCrit = $c->getNewCriterion(self::MEMBERS, $kuser->getId(), Criteria::LIKE);
             $membersCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
             $crit->addOr($membersCrit);
         }
         $c->addAnd($crit);
     }
     self::$s_criteria_filter->setFilter($c);
 }
Esempio n. 2
0
 public static function setDefaultCriteriaFilter()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = new Criteria();
     $c->add(self::DELETED_AT, null, Criteria::EQUAL);
     self::$s_criteria_filter->setFilter($c);
 }
Esempio n. 3
0
 public static function setDefaultCriteriaFilter()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
     $partnerId = kCurrentContext::$ks_partner_id ? kCurrentContext::$ks_partner_id : kCurrentContext::$partner_id;
     if ($partnerId != Partner::BATCH_PARTNER_ID || self::$ignoreDeleted) {
         $c->add(self::STATUS, array(CategoryStatus::DELETED, CategoryStatus::PURGED), Criteria::NOT_IN);
     } else {
         $c->add(self::STATUS, CategoryStatus::PURGED, Criteria::NOT_EQUAL);
     }
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         //add context as filter
         $privacyContextCrit = $c->getNewCriterion(self::PRIVACY_CONTEXTS, kEntitlementUtils::getKsPrivacyContext(), KalturaCriteria::IN_LIKE);
         $privacyContextCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $c->addAnd($privacyContextCrit);
         $crit = $c->getNewCriterion(self::DISPLAY_IN_SEARCH, DisplayInSearchType::PARTNER_ONLY, Criteria::EQUAL);
         $crit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $kuser = null;
         $ksString = kCurrentContext::$ks ? kCurrentContext::$ks : '';
         if ($ksString != '') {
             $kuser = kCurrentContext::getCurrentKsKuser();
         }
         if ($kuser) {
             // get the groups that the user belongs to in case she is not associated to the category directly
             $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuser->getId());
             $kgroupIds[] = $kuser->getId();
             $membersCrit = $c->getNewCriterion(self::MEMBERS, $kgroupIds, KalturaCriteria::IN_LIKE);
             $membersCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
             $crit->addOr($membersCrit);
         }
         $c->addAnd($crit);
     }
     self::$s_criteria_filter->setFilter($c);
 }