本文整理汇总了PHP中kuserPeer::getActiveKuserByPartnerAndUid方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::getActiveKuserByPartnerAndUid方法的具体用法?PHP kuserPeer::getActiveKuserByPartnerAndUid怎么用?PHP kuserPeer::getActiveKuserByPartnerAndUid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::getActiveKuserByPartnerAndUid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setEntitledPusersPublish
public function setEntitledPusersPublish($v)
{
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$entitledUserPuserPublish = array();
$v = trim($v);
if ($v == '') {
$this->putInCustomData("entitledUserPuserPublish", serialize($entitledUserPuserPublish));
return;
}
$entitledPusersPublish = explode(',', $v);
if (!count($entitledPusersPublish)) {
return;
}
foreach ($entitledPusersPublish as $puserId) {
$puserId = trim($puserId);
if ($puserId === '') {
continue;
}
$kuser = kuserPeer::getActiveKuserByPartnerAndUid($partnerId, $puserId);
if (!$kuser) {
throw new kCoreException('Invalid user id', kCoreException::INVALID_USER_ID);
}
$entitledUserPuserPublish[$kuser->getId()] = $kuser->getPuserId();
}
$this->putInCustomData("entitledUserPuserPublish", serialize($entitledUserPuserPublish));
}
示例2: indexAction
/**
* Index CategoryUser by userid and category id
*
* @action index
* @param string $userId
* @param int $categoryId
* @param bool $shouldUpdate
* @throws KalturaErrors::INVALID_CATEGORY_USER_ID
* @return int
*/
public function indexAction($userId, $categoryId, $shouldUpdate = true)
{
if (kEntitlementUtils::getEntitlementEnforcement()) {
throw new KalturaAPIException(KalturaErrors::CANNOT_INDEX_OBJECT_WHEN_ENTITLEMENT_IS_ENABLE);
}
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$kuser = kuserPeer::getActiveKuserByPartnerAndUid($partnerId, $userId);
if (!$kuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$dbCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($categoryId, $kuser->getId(), null, false);
if (!$dbCategoryKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_CATEGORY_USER_ID);
}
if (!$shouldUpdate) {
$dbCategoryKuser->setUpdatedAt(time());
$dbCategoryKuser->save();
return $dbCategoryKuser->getId();
}
$dbCategoryKuser->reSetCategoryFullIds();
$dbCategoryKuser->reSetScreenName();
$dbCategoryKuser->save();
return $dbCategoryKuser->getId();
}
示例3: listAction
/**
* @action list
* @param KalturaLikeFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaLikeListResponse
*/
public function listAction(KalturaLikeFilter $filter = null, KalturaFilterPager $pager = null)
{
if (!$filter) {
$filter = new KalturaLikeFilter();
} else {
if ($filter->entryIdEqual && !entryPeer::retrieveByPK($filter->entryIdEqual)) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $filter->entryIdEqual);
}
if ($filter->userIdEqual && !kuserPeer::getActiveKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $filter->userIdEqual)) {
throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
}
}
if (!$pager) {
$pager = new KalturaFilterPager();
}
return $filter->getListResponse($pager, null);
}
示例4: initPartnerUserObjects
private static function initPartnerUserObjects()
{
if (self::$ksPartnerId == Partner::BATCH_PARTNER_ID) {
self::$operatingPartner = null;
self::$operatingPartnerId = self::$ksPartnerId;
return;
}
$ksPartner = null;
$requestedPartner = null;
// init ks partner = operating partner
if (!is_null(self::$ksPartnerId)) {
$ksPartner = PartnerPeer::retrieveByPK(self::$ksPartnerId);
if (!$ksPartner) {
KalturaLog::crit('Unknown partner id [' . self::$ksPartnerId . ']');
throw new kCoreException("Unknown partner Id [" . self::$ksPartnerId . "]", kCoreException::ID_NOT_FOUND);
}
}
// init requested partner
if (!is_null(self::$requestedPartnerId)) {
$requestedPartner = PartnerPeer::retrieveByPK(self::$requestedPartnerId);
if (!$requestedPartner) {
KalturaLog::crit('Unknown partner id [' . self::$requestedPartnerId . ']');
throw new kCoreException("Unknown partner Id [" . self::$requestedPartnerId . "]", kCoreException::ID_NOT_FOUND);
}
}
// init current kuser
if (self::$ksUserId && !self::$kuser) {
// will never be null because ks::uid is never null
kuserPeer::setUseCriteriaFilter(false);
self::$kuser = kuserPeer::getActiveKuserByPartnerAndUid(self::$ksPartnerId, self::$ksUserId);
kuserPeer::setUseCriteriaFilter(true);
if (!self::$kuser) {
self::$kuser = null;
// error not thrown to support adding users 'on-demand'
// current session will get default role according to session type (user/admin)
}
}
// choose operating partner!
if ($ksPartner) {
self::$operatingPartner = $ksPartner;
self::$operatingPartnerId = $ksPartner->getId();
} else {
if (!self::$ksString && $requestedPartner) {
self::$operatingPartner = $requestedPartner;
self::$operatingPartnerId = $requestedPartner->getId();
self::$kuser = null;
}
}
}
示例5: indexAction
/**
* Index an entry by id.
*
* @action index
* @param string $id
* @param bool $shouldUpdate
* @return string
* @throws KalturaErrors::USER_NOT_FOUND
*/
function indexAction($id, $shouldUpdate = true)
{
$kuser = kuserPeer::getActiveKuserByPartnerAndUid(kCurrentContext::getCurrentPartnerId(), $id);
if (!$kuser) {
throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
}
$kuser->indexToSearchIndex();
return $kuser->getPuserId();
}
示例6: retrieveEntitledAndNonIndexedByKuser
/**
* Return all categories kuser is entitled to view the content.
* (User may call category->get to view a category - but not to view its content)
*
* @param int $kuserId
* @param int $limit
* @return array<categories>
*/
public static function retrieveEntitledAndNonIndexedByKuser($kuserId, $limit)
{
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$partner = PartnerPeer::retrieveByPK($partnerId);
$categoryGroupSize = category::MAX_NUMBER_OF_MEMBERS_TO_BE_INDEXED_ON_ENTRY;
if ($partner && $partner->getCategoryGroupSize()) {
$categoryGroupSize = $partner->getCategoryGroupSize();
}
$c = KalturaCriteria::create(categoryPeer::OM_CLASS);
$filteredCategoriesIds = entryPeer::getFilterdCategoriesIds();
if (count($filteredCategoriesIds)) {
$c->addAnd(categoryPeer::ID, $filteredCategoriesIds, Criteria::IN);
}
$membersCountCrit = $c->getNewCriterion(categoryPeer::MEMBERS_COUNT, $categoryGroupSize, Criteria::GREATER_THAN);
$membersCountCrit->addOr($c->getNewCriterion(categoryPeer::ENTRIES_COUNT, entry::CATEGORY_ENTRIES_COUNT_LIMIT_TO_BE_INDEXED, Criteria::GREATER_THAN));
$c->addAnd($membersCountCrit);
$c->setLimit($limit);
$c->addDescendingOrderByColumn(categoryPeer::UPDATED_AT);
//all fields needed from default criteria
//here we cannot use the default criteria, as we need to get all categories user is entitled to view the content.
//not deleted or purged
$c->add(self::STATUS, array(CategoryStatus::DELETED, CategoryStatus::PURGED), Criteria::NOT_IN);
$c->add(self::PARTNER_ID, $partnerId, Criteria::EQUAL);
//add privacy context
$privacyContextCrit = $c->getNewCriterion(self::PRIVACY_CONTEXTS, kEntitlementUtils::getKsPrivacyContext(), KalturaCriteria::IN_LIKE);
$privacyContextCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
$c->addAnd($privacyContextCrit);
//set privacy by ks and type
$crit = $c->getNewCriterion(self::PRIVACY, kEntitlementUtils::getPrivacyForKs(), Criteria::IN);
$crit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
//user is entitled to view all cantent that belong to categoires he is a membr of
$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);
categoryPeer::setUseCriteriaFilter(false);
$categories = self::doSelect($c);
categoryPeer::setUseCriteriaFilter(true);
return $categories;
}