public function getScopedProviderJobData(kScope $scope = null) { $ret = new kEmailNotificationCategoryRecipientJobData(); if (!$this->categoryId) { return $ret; } if ($this->categoryId instanceof kStringField) { $this->categoryId->setScope($scope); } $implicitCategoryId = $this->categoryId->getValue(); $categoryUserFilter = new categoryKuserFilter(); $categoryUserFilter->set('_matchor_permission_names', PermissionName::CATEGORY_SUBSCRIBE); if ($this->categoryUserFilter) { $categoryUserFilter = $this->categoryUserFilter; } $categoryUserFilter->setCategoryIdEqual($implicitCategoryId); $ret->setCategoryUserFilter($categoryUserFilter); return $ret; }
protected function addDeleteCategoryKuserJob($categoryId, $deleteCategoryDirectMembersOnly = false) { $filter = new categoryKuserFilter(); $filter->setCategoryIdEqual($categoryId); $filter->set('_category_direct_members', $deleteCategoryDirectMembersOnly); $c = new Criteria(); $c->add(categoryKuserPeer::CATEGORY_ID, $categoryId); if (!categoryKuserPeer::doSelectOne($c)) { return; } kJobsManager::addDeleteJob($this->getPartnerId(), DeleteObjectType::CATEGORY_USER, $filter); }
$criteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::DELETED, Criteria::NOT_EQUAL); $criteria->add(EventNotificationTemplatePeer::SYSTEM_NAME, array('New_Item_Pending_Moderation', 'New_Item_Pending_Moderation_2', 'Entry_Was_Added_To_Channel'), Criteria::IN); $criteria->addAscendingOrderByColumn(EventNotificationTemplatePeer::ID); $criteria->setLimit(100); $eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($criteria); $lastId = 0; $count = 0; while ($eventNotificationTemplates) { foreach ($eventNotificationTemplates as $eventNotificationTemplate) { /* @var $eventNotificationTemplate EmailNotificationTemplate */ $lastId = $eventNotificationTemplate->getId(); $categoryId = new kEvalStringField(); $categoryId->setCode('$scope->getEvent()->getObject()->getCategoryId()'); $categoryUserFilter = new categoryKuserFilter(); if ($eventNotificationTemplate->getSystemName() == 'Entry_Was_Added_To_Channel') { $categoryUserFilter->set('_matchor_permission_names', 'CATEGORY_SUBSCRIBE'); } else { $categoryUserFilter->set('_matchor_permission_names', 'CATEGORY_MODERATE'); } $bcc = new kEmailNotificationCategoryRecipientProvider(); $bcc->setCategoryId($categoryId); $bcc->setCategoryUserFilter($categoryUserFilter); $eventNotificationTemplate->setBcc($bcc); $eventNotificationTemplate->setTo(null); $eventNotificationTemplate->save(); $count++; } $criteria->add(EventNotificationTemplatePeer::ID, $lastId, Criteria::GREATER_THAN); $eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($criteria); } KalturaLog::log('Done: updated ' . $count . ' templates');
private function removeNonMemberKusers() { $filter = new categoryKuserFilter(); $filter->setCategoryIdEqual($this->getId()); $filter->set('_notcontains_permission_names', PermissionName::CATEGORY_CONTRIBUTE . "," . PermissionName::CATEGORY_EDIT . "," . PermissionName::CATEGORY_MODERATE . "," . PermissionName::CATEGORY_VIEW); kJobsManager::addDeleteJob($this->getPartnerId(), DeleteObjectType::CATEGORY_USER, $filter); }