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


PHP kuserPeer::setUseCriteriaFilter方法代码示例

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


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

示例1: deleteAction

 /**
  * delete by userId and groupId
  *
  * @action delete
  * @param string $userId
  * @param string $groupId
  */
 function deleteAction($userId, $groupId)
 {
     $partnerId = $this->getPartnerId();
     //verify kuser exists
     $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId);
     if (!$kuser) {
         throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $userId);
     }
     //verify group exists
     $kgroup = kuserPeer::getKuserByPartnerAndUid($partnerId, $groupId);
     if (!$kgroup) {
         //if the delete worker was triggered due to group deletion
         if (kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
             throw new KalturaAPIException(KalturaErrors::GROUP_NOT_FOUND, $groupId);
         }
         kuserPeer::setUseCriteriaFilter(false);
         $kgroup = kuserPeer::getKuserByPartnerAndUid($partnerId, $groupId);
         kuserPeer::setUseCriteriaFilter(true);
         if (!$kgroup) {
             throw new KalturaAPIException(KalturaErrors::GROUP_NOT_FOUND, $groupId);
         }
     }
     $dbKuserKgroup = KuserKgroupPeer::retrieveByKuserIdAndKgroupId($kuser->getId(), $kgroup->getId());
     if (!$dbKuserKgroup) {
         throw new KalturaAPIException(KalturaErrors::GROUP_USER_DOES_NOT_EXIST, $userId, $groupId);
     }
     $dbKuserKgroup->setStatus(KuserKgroupStatus::DELETED);
     $dbKuserKgroup->save();
     $groupUser = new KalturaGroupUser();
     $groupUser->fromObject($dbKuserKgroup);
 }
开发者ID:DBezemer,项目名称:server,代码行数:38,代码来源:GroupUserService.php

示例2: registerAction

 /**
  * Create a new Partner object
  * 
  * @action register
  * @param KalturaPartner $partner
  * @param string $cmsPassword
  * @param int $templatePartnerId
  * @param bool $silent
  * @return KalturaPartner
  *
  * @throws APIErrors::PARTNER_REGISTRATION_ERROR
  */
 public function registerAction(KalturaPartner $partner, $cmsPassword = "", $templatePartnerId = null, $silent = false)
 {
     KalturaResponseCacher::disableCache();
     $dbPartner = $partner->toPartner();
     $c = new Criteria();
     $c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $partner->adminEmail, Criteria::EQUAL);
     $existingUser = UserLoginDataPeer::doSelectOne($c);
     /*@var $exisitingUser UserLoginData */
     try {
         if ($cmsPassword == "") {
             $cmsPassword = null;
         }
         $parentPartnerId = null;
         if ($this->getKs() && $this->getKs()->isAdmin()) {
             $parentPartnerId = $this->getKs()->partner_id;
             if ($parentPartnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
                 $parentPartnerId = null;
             } else {
                 // only if this partner is a var/group, allow setting it as parent for the new created partner
                 $parentPartner = PartnerPeer::retrieveByPK($parentPartnerId);
                 if (!($parentPartner->getPartnerGroupType() == PartnerGroupType::VAR_GROUP || $parentPartner->getPartnerGroupType() == PartnerGroupType::GROUP)) {
                     throw new KalturaAPIException(KalturaErrors::NON_GROUP_PARTNER_ATTEMPTING_TO_ASSIGN_CHILD, $parentPartnerId);
                 }
                 if ($templatePartnerId) {
                     $templatePartner = PartnerPeer::retrieveByPK($templatePartnerId);
                     if (!$templatePartner || $templatePartner->getPartnerParentId() != $parentPartnerId) {
                         throw new KalturaAPIException(KalturaErrors::NON_GROUP_PARTNER_ATTEMPTING_TO_ASSIGN_CHILD, $parentPartnerId);
                     }
                 }
             }
         }
         $partner_registration = new myPartnerRegistration($parentPartnerId);
         $ignorePassword = false;
         if ($existingUser && ($this->getKs()->partner_id == Partner::ADMIN_CONSOLE_PARTNER_ID || $this->getKs()->partner_id == $parentPartnerId)) {
             kuserPeer::setUseCriteriaFilter(false);
             $kuserOfLoginData = kuserPeer::getKuserByEmail($partner->adminEmail, $existingUser->getConfigPartnerId());
             kuserPeer::setUseCriteriaFilter(true);
             if ($kuserOfLoginData) {
                 $ignorePassword = true;
             }
         }
         list($pid, $subpid, $pass, $hashKey) = $partner_registration->initNewPartner($dbPartner->getName(), $dbPartner->getAdminName(), $dbPartner->getAdminEmail(), $dbPartner->getCommercialUse(), "yes", $dbPartner->getDescription(), $dbPartner->getUrl1(), $cmsPassword, $dbPartner, $ignorePassword, $templatePartnerId);
         $dbPartner = PartnerPeer::retrieveByPK($pid);
         // send a confirmation email as well as the result of the service
         $partner_registration->sendRegistrationInformationForPartner($dbPartner, false, $existingUser, $silent);
     } catch (Exception $ex) {
         KalturaLog::CRIT($ex);
         // this assumes the partner name is unique - TODO - remove key from DB !
         throw new KalturaAPIException(APIErrors::PARTNER_REGISTRATION_ERROR);
     }
     $partner = new KalturaPartner();
     // start from blank
     $partner->fromPartner($dbPartner);
     $partner->secret = $dbPartner->getSecret();
     $partner->adminSecret = $dbPartner->getAdminSecret();
     $partner->cmsPassword = $pass;
     return $partner;
 }
开发者ID:DBezemer,项目名称:server,代码行数:70,代码来源:PartnerService.php

示例3: getAdminUsers

function getAdminUsers($lastUser, $userLimitEachLoop)
{
    kuserPeer::clearInstancePool();
    UserRolePeer::clearInstancePool();
    $c = new Criteria();
    $c->addAnd(kuserPeer::ID, $lastUser, Criteria::GREATER_THAN);
    $c->addAnd(kuserPeer::IS_ADMIN, true, Criteria::EQUAL);
    $c->addAscendingOrderByColumn(kuserPeer::ID);
    $c->setLimit($userLimitEachLoop);
    kuserPeer::setUseCriteriaFilter(false);
    $users = kuserPeer::doSelect($c);
    kuserPeer::setUseCriteriaFilter(true);
    return $users;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:04_assign_default_role_to_admin_users.php

示例4: Criteria

        if ($key === 'admin') {
            $partner = PartnerPeer::retrieveByPk(-2);
            $partner->setAdminSessionRoleId($newRole->getId());
            $partner->save();
        }
    }
}
//------------------------------------------------------
// get users
$c = new Criteria();
$c->addAscendingOrderByColumn(kuserPeer::ID);
$c->addAnd(kuserPeer::PARTNER_ID, ADMIN_CONSOLE_PARTNER_ID, Criteria::EQUAL);
kuserPeer::clearInstancePool();
kuserPeer::setUseCriteriaFilter(false);
$users = kuserPeer::doSelect($c);
kuserPeer::setUseCriteriaFilter(true);
// set relevant role to each user
foreach ($users as $user) {
    KalturaLog::log('Current user id [' . $user->getId() . ']');
    $partnerData = $user->getPartnerData();
    if ($partnerData) {
        $partnerData = unserialize($partnerData);
        $oldRole = $partnerData->role;
    } else {
        $oldRole = 'guest';
    }
    $newRole = getNewRole($oldRole, $userRoles);
    if (!$newRole) {
        KalturaLog::alert('ERROR - Critical error occured - skipping kuser id [' . $user->getId() . '] email [' . $user->getEmail() . ']!');
        continue;
    }
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:01_create_base_admin_console_roles_and_migrate_users.php

示例5: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     $newEntry->setCategories(null);
     $newEntry->setCategoriesIds(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         $newEntry->setCreatorKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     if ($entry->getStatus() != entryStatus::READY) {
         $clonePendingEntries = $entry->getClonePendingEntries();
         $clonePendingEntries[] = $newEntry->getId();
         $entry->setClonePendingEntries($clonePendingEntries);
         $entry->save();
     } else {
         self::copyEntryData($entry, $newEntry);
     }
     //if entry is a static playlist, link between it and its new child entries
     if ($entry->getType() == entryType::PLAYLIST) {
         switch ($entry->getMediaType()) {
             case entry::ENTRY_MEDIA_TYPE_TEXT:
                 $from = $entry->getDataContent();
                 KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
                 $fromEntryIds = explode(",", $from);
                 $toEntryIds = array();
                 foreach ($fromEntryIds as $fromEntryId) {
                     $toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
                 }
                 $newEntry->setDataContent(implode(",", $toEntryIds));
                 break;
             case entry::ENTRY_MEDIA_TYPE_XML:
                 list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
                 $toPlaylistXml = new SimpleXMLElement("<playlist/>");
                 $toPlaylistXml->addChild("total_results", $totalResults);
                 $toFiltersXml = $toPlaylistXml->addChild("filters");
                 foreach ($fromFiltersList as $filterXML) {
                     $entryFilter = new entryFilter();
                     $entryFilter->fillObjectFromXml($filterXML, "_");
                     if (isset($entryFilter->fields["_matchand_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_matchor_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchor_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_in_category_ancestor_id"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_in_category_ancestor_id"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例6: getListResponse

 public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
 {
     if ($this->userIdIn) {
         $usersIds = explode(',', $this->userIdIn);
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         $c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
         $kusers = kuserPeer::doSelect($c);
         $usersIds = array();
         foreach ($kusers as $kuser) {
             /* @var $kuser kuser */
             $usersIds[] = $kuser->getId();
         }
         $this->userIdIn = implode(',', $usersIds);
     }
     if ($this->relatedGroupsByUserId) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $userIds = array();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->relatedGroupsByUserId);
         $c->add(kuserPeer::TYPE, KuserType::USER);
         $kuser = kuserPeer::doSelectOne($c);
         if (!$kuser) {
             $response = new KalturaCategoryUserListResponse();
             $response->objects = new KalturaCategoryUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuser->getId());
         if (!is_null($kgroupIds) && is_array($kgroupIds)) {
             $userIds = $kgroupIds;
         }
         $userIds[] = $kuser->getId();
         // if userIdIn is also set in the filter need to intersect the two arrays.
         if (isset($this->userIdIn)) {
             $curUserIds = explode(',', $this->userIdIn);
             $userIds = array_intersect($curUserIds, $userIds);
         }
         $this->userIdIn = implode(',', $userIds);
     }
     if ($this->userIdEqual) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->userIdEqual);
         if (kCurrentContext::$ks_partner_id == Partner::BATCH_PARTNER_ID) {
             //batch should be able to get categoryUser of deleted users.
             kuserPeer::setUseCriteriaFilter(false);
         }
         // in case of more than one deleted kusers - get the last one
         $c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
         $kuser = kuserPeer::doSelectOne($c);
         kuserPeer::setUseCriteriaFilter(true);
         if (!$kuser) {
             KalturaLog::debug('User not found');
             $response = new KalturaCategoryUserListResponse();
             $response->objects = new KalturaCategoryUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $this->userIdEqual = $kuser->getId();
     }
     $categories = array();
     if ($this->categoryIdEqual) {
         $categories[] = categoryPeer::retrieveByPK($this->categoryIdEqual);
     } elseif ($this->categoryIdIn) {
         $categories = categoryPeer::retrieveByPKs(explode(',', $this->categoryIdIn));
     }
     $categoriesInheritanceRoot = array();
     foreach ($categories as $category) {
         /* @var $category category */
         if (is_null($category)) {
             continue;
         }
         if ($category->getInheritanceType() == InheritanceType::INHERIT) {
             if ($this->categoryDirectMembers && kCurrentContext::$master_partner_id == Partner::BATCH_PARTNER_ID) {
                 $categoriesInheritanceRoot[$category->getId()] = $category->getId();
             } else {
                 //if category inheris members - change filter to -> inherited from parent id = category->getIheritedParent
                 $categoriesInheritanceRoot[$category->getInheritedParentId()] = $category->getInheritedParentId();
             }
         } else {
             $categoriesInheritanceRoot[$category->getId()] = $category->getId();
         }
     }
     $this->categoryDirectMembers = null;
     $this->categoryIdEqual = null;
     $this->categoryIdIn = implode(',', $categoriesInheritanceRoot);
     //if filter had categories that doesn't exists or not entitled - should return 0 objects.
     if (count($categories) && !count($categoriesInheritanceRoot)) {
         $response = new KalturaCategoryUserListResponse();
         $response->totalCount = 0;
         return $response;
     }
     $categoryKuserFilter = $this->toObject();
     $c = KalturaCriteria::create(categoryKuserPeer::OM_CLASS);
     $categoryKuserFilter->attachToCriteria($c);
     $pager->attachToCriteria($c);
//.........这里部分代码省略.........
开发者ID:kubrickfr,项目名称:server,代码行数:101,代码来源:KalturaCategoryUserFilter.php

示例7: postInsert

 /**
  * Code to be run after inserting to database
  * @param PropelPDO $con 
  */
 public function postInsert(PropelPDO $con = null)
 {
     kuserPeer::setUseCriteriaFilter(false);
     $this->reload();
     kuserPeer::setUseCriteriaFilter(true);
     kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
     if ($this->copiedFrom) {
         kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:Basekuser.php

示例8: deleteAction

 /**
  * Delete a CategoryUser
  * 
  * @action delete
  * @param int $categoryId
  * @param string $userId
  */
 function deleteAction($categoryId, $userId)
 {
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId);
     if (!$kuser) {
         if (kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
             throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $userId);
         }
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId);
         kuserPeer::setUseCriteriaFilter(true);
         if (!$kuser) {
             throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $userId);
         }
     }
     $dbCategoryKuser = categoryKuserPeer::retrieveByCategoryIdAndKuserId($categoryId, $kuser->getId());
     /* @var $dbCategoryKuser categoryKuser */
     if (!$dbCategoryKuser) {
         throw new KalturaAPIException(KalturaErrors::INVALID_CATEGORY_USER_ID, $categoryId, $userId);
     }
     $category = categoryPeer::retrieveByPK($categoryId);
     if (!$category) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $categoryId);
     }
     if ($category->getInheritanceType() == InheritanceType::INHERIT && kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_INHERIT_MEMBERS, $categoryId);
     }
     // only manager can remove memnger or users remove himself
     $currentKuserCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($dbCategoryKuser->getCategoryId());
     if ((!$currentKuserCategoryKuser || $currentKuserCategoryKuser->getPermissionLevel() != CategoryKuserPermissionLevel::MANAGER && kCurrentContext::$ks_uid != $userId) && kCurrentContext::$ks_partner_id != Partner::BATCH_PARTNER_ID && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_USER);
     }
     if ($dbCategoryKuser->getKuserId() == $category->getKuserId() && kCurrentContext::$ks_partner_id != Partner::BATCH_PARTNER_ID) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_USER_OWNER);
     }
     $dbCategoryKuser->setStatus(CategoryKuserStatus::DELETED);
     $dbCategoryKuser->save();
 }
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:CategoryUserService.php

示例9: getListResponse

 public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $this->validateUserIdOrGroupIdFiltered();
     if ($this->groupIdEqual) {
         $partnerId = kCurrentContext::getCurrentPartnerId();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->groupIdEqual);
         $c->add(kuserPeer::TYPE, KuserType::GROUP);
         if (kCurrentContext::$ks_partner_id == Partner::BATCH_PARTNER_ID) {
             //batch should be able to get categoryUser of deleted users.
             kuserPeer::setUseCriteriaFilter(false);
         }
         // in case of more than one deleted kusers - get the last one
         $c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
         $kuser = kuserPeer::doSelectOne($c);
         kuserPeer::setUseCriteriaFilter(true);
         if (!$kuser) {
             $response = new KalturaGroupUserListResponse();
             $response->objects = new KalturaGroupUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $this->groupIdEqual = $kuser->getId();
     }
     if ($this->userIdEqual) {
         $partnerId = kCurrentContext::getCurrentPartnerId();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->userIdEqual);
         $c->add(kuserPeer::TYPE, KuserType::USER);
         $kuser = kuserPeer::doSelectOne($c);
         if (!$kuser) {
             $response = new KalturaGroupUserListResponse();
             $response->objects = new KalturaGroupUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $this->userIdEqual = $kuser->getId();
     }
     if ($this->userIdIn) {
         $usersIds = explode(',', $this->userIdIn);
         $partnerId = kCurrentContext::getCurrentPartnerId();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         $c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
         $c->add(kuserPeer::TYPE, KuserType::USER);
         $kusers = kuserPeer::doSelect($c);
         if (!$kusers) {
             $response = new KalturaGroupUserListResponse();
             $response->objects = new KalturaGroupUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $usersIds = array();
         foreach ($kusers as $kuser) {
             /* @var $kuser kuser */
             $usersIds[] = $kuser->getId();
         }
         $this->userIdIn = implode(',', $usersIds);
     }
     if ($this->groupIdIn) {
         $groupIdIn = explode(',', $this->groupIdIn);
         $partnerId = kCurrentContext::getCurrentPartnerId();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         $c->add(kuserPeer::PUSER_ID, $groupIdIn, Criteria::IN);
         $c->add(kuserPeer::TYPE, KuserType::GROUP);
         $kusers = kuserPeer::doSelect($c);
         if (!$kusers) {
             $response = new KalturaGroupUserListResponse();
             $response->objects = new KalturaGroupUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $groupIdIn = array();
         foreach ($kusers as $kuser) {
             /* @var $kuser kuser */
             $groupIdIn[] = $kuser->getId();
         }
         $this->groupIdIn = implode(',', $groupIdIn);
     }
     $kuserKgroupFilter = $this->toObject();
     $c = KalturaCriteria::create(KuserKgroupPeer::OM_CLASS);
     $kuserKgroupFilter->attachToCriteria($c);
     $pager->attachToCriteria($c);
     $c->applyFilters();
     $list = KuserKgroupPeer::doSelect($c);
     $newList = KalturaGroupUserArray::fromDbArray($list, $responseProfile);
     $response = new KalturaGroupUserListResponse();
     $response->objects = $newList;
     $resultCount = count($newList);
     if ($resultCount && $resultCount < $pager->pageSize) {
         $totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
     } else {
         KalturaFilterPager::detachFromCriteria($c);
         $totalCount = KuserKgroupPeer::doCount($c);
     }
     $response->totalCount = $totalCount;
     return $response;
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:KalturaGroupUserFilter.php

示例10: chdir

<?php

chdir(dirname(__FILE__));
require_once __DIR__ . '/../../bootstrap.php';
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
    $c->add(kuserPeer::UPDATED_AT, $argv[1], Criteria::GREATER_EQUAL);
}
if ($argc > 2 && is_numeric($argv[2])) {
    $c->add(kuserPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(kuserPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    kuserPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(kuserPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(kuserPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$entries = kuserPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($entries)) {
    foreach ($entries as $entry) {
        /* @var $entry kuser */
        KalturaLog::log('kuser id ' . $entry->getId() . ' updated at ' . $entry->getUpdatedAt(null));
        try {
            $ret = $sphinx->saveToSphinx($entry, true);
        } catch (Exception $e) {
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:populateSphinxKusers.php

示例11: loginImpl

 /**
  * Get a session using user email and password
  * 
  * @param string $puserId
  * @param string $loginEmail
  * @param string $password
  * @param int $partnerId
  * @param int $expiry
  * @param string $privileges
  * 
  * @return string KS
  *
  * @throws KalturaErrors::USER_NOT_FOUND
  * @thrown KalturaErrors::LOGIN_RETRIES_EXCEEDED
  * @thrown KalturaErrors::LOGIN_BLOCKED
  * @thrown KalturaErrors::PASSWORD_EXPIRED
  * @thrown KalturaErrors::INVALID_PARTNER_ID
  * @thrown KalturaErrors::INTERNAL_SERVERL_ERROR
  * @throws KalturaErrors::USER_IS_BLOCKED
  */
 protected function loginImpl($puserId, $loginEmail, $password, $partnerId = null, $expiry = 86400, $privileges = '*')
 {
     KalturaResponseCacher::disableCache();
     myPartnerUtils::resetPartnerFilter('kuser');
     kuserPeer::setUseCriteriaFilter(true);
     // if a KS of a specific partner is used, don't allow logging in to a different partner
     if ($this->getPartnerId() && $partnerId && $this->getPartnerId() != $partnerId) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $partnerId);
     }
     if ($loginEmail && !$partnerId) {
         $this->validateApiAccessControlByEmail($loginEmail);
     }
     try {
         if ($loginEmail) {
             $user = UserLoginDataPeer::userLoginByEmail($loginEmail, $password, $partnerId);
         } else {
             $user = kuserPeer::userLogin($puserId, $password, $partnerId);
         }
     } catch (kUserException $e) {
         $code = $e->getCode();
         if ($code == kUserException::LOGIN_DATA_NOT_FOUND) {
             throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
         }
         if ($code == kUserException::USER_NOT_FOUND) {
             throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
         } else {
             if ($code == kUserException::LOGIN_RETRIES_EXCEEDED) {
                 throw new KalturaAPIException(KalturaErrors::LOGIN_RETRIES_EXCEEDED);
             } else {
                 if ($code == kUserException::LOGIN_BLOCKED) {
                     throw new KalturaAPIException(KalturaErrors::LOGIN_BLOCKED);
                 } else {
                     if ($code == kUserException::PASSWORD_EXPIRED) {
                         throw new KalturaAPIException(KalturaErrors::PASSWORD_EXPIRED);
                     } else {
                         if ($code == kUserException::WRONG_PASSWORD) {
                             throw new KalturaAPIException(KalturaErrors::USER_WRONG_PASSWORD);
                         } else {
                             if ($code == kUserException::USER_IS_BLOCKED) {
                                 throw new KalturaAPIException(KalturaErrors::USER_IS_BLOCKED);
                             }
                         }
                     }
                 }
             }
         }
         throw new $e();
     }
     if (!$user) {
         throw new KalturaAPIException(KalturaErrors::LOGIN_DATA_NOT_FOUND);
     }
     if ($partnerId && $user->getPartnerId() != $partnerId || $this->getPartnerId() && !$partnerId && $user->getPartnerId() != $this->getPartnerId()) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $partnerId);
     }
     $partner = PartnerPeer::retrieveByPK($user->getPartnerId());
     if (!$partner || $partner->getStatus() == Partner::PARTNER_STATUS_FULL_BLOCK) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $user->getPartnerId());
     }
     $ks = null;
     $admin = $user->getIsAdmin() ? KalturaSessionType::ADMIN : KalturaSessionType::USER;
     // create a ks for this admin_kuser as if entered the admin_secret using the API
     kSessionUtils::createKSessionNoValidations($partner->getId(), $user->getPuserId(), $ks, $expiry, $admin, "", $privileges);
     return $ks;
 }
开发者ID:DBezemer,项目名称:server,代码行数:84,代码来源:KalturaBaseUserService.php

示例12: setPuserId

 public function setPuserId($v)
 {
     $this->puserId = $v;
     kuserPeer::setUseCriteriaFilter(false);
     $kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $this->puserId, true);
     kuserPeer::setUseCriteriaFilter(true);
     if (!$kuser) {
         // Associate new kuser for the specified partner
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $v);
     }
     if ($kuser) {
         return $this->setKuserId($kuser->getId());
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:14,代码来源:AuditTrail.php

示例13: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     $newEntry->setCategories(null);
     $newEntry->setCategoriesIds(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         $newEntry->setCreatorKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     // for any type that does not require assets:
     $shouldCopyDataForNonClip = true;
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         $shouldCopyDataForNonClip = false;
     }
     if ($entry->getType() == entryType::PLAYLIST) {
         $shouldCopyDataForNonClip = false;
     }
     $shouldCopyDataForClip = false;
     // only images get their data copied
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $shouldCopyDataForClip = true;
         }
     }
     //if entry is a static playlist, link between it and its new child entries
     if ($entry->getType() == entryType::PLAYLIST) {
         switch ($entry->getMediaType()) {
             case entry::ENTRY_MEDIA_TYPE_TEXT:
                 $from = $entry->getDataContent();
                 KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
                 $fromEntryIds = explode(",", $from);
                 $toEntryIds = array();
                 foreach ($fromEntryIds as $fromEntryId) {
                     $toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
                 }
                 $newEntry->setDataContent(implode(",", $toEntryIds));
                 break;
             case entry::ENTRY_MEDIA_TYPE_XML:
                 list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
                 $toPlaylistXml = new SimpleXMLElement("<playlist/>");
                 $toPlaylistXml->addChild("total_results", $totalResults);
                 $toFiltersXml = $toPlaylistXml->addChild("filters");
                 foreach ($fromFiltersList as $filterXML) {
                     $entryFilter = new entryFilter();
                     $entryFilter->fillObjectFromXml($filterXML, "_");
                     if (isset($entryFilter->fields["_matchand_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_matchor_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
//.........这里部分代码省略.........
开发者ID:kubrickfr,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例14: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     defPartnerservices2baseAction::disableCache();
     kuserPeer::setUseCriteriaFilter(false);
     $email = trim($this->getPM("email"));
     $password = trim($this->getPM("password"));
     $loginData = UserLoginDataPeer::getByEmail($email);
     // be sure to return the same error if there are no admins in the list and when there are none matched -
     // so no hint about existing admin will leak
     if (!$loginData) {
         $this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
         return;
     }
     try {
         $adminKuser = UserLoginDataPeer::userLoginByEmail($email, $password, $partner_id);
     } catch (kUserException $e) {
         $code = $e->getCode();
         if ($code == kUserException::USER_NOT_FOUND) {
             $this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
             return null;
         }
         if ($code == kUserException::LOGIN_DATA_NOT_FOUND) {
             $this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
             return null;
         } else {
             if ($code == kUserException::LOGIN_RETRIES_EXCEEDED) {
                 $this->addError(APIErrors::LOGIN_RETRIES_EXCEEDED);
                 return null;
             } else {
                 if ($code == kUserException::LOGIN_BLOCKED) {
                     $this->addError(APIErrors::LOGIN_BLOCKED);
                     return null;
                 } else {
                     if ($code == kUserException::PASSWORD_EXPIRED) {
                         $this->addError(APIErrors::PASSWORD_EXPIRED);
                         return null;
                     } else {
                         if ($code == kUserException::WRONG_PASSWORD) {
                             $this->addError(APIErrors::USER_WRONG_PASSWORD);
                             return null;
                         } else {
                             if ($code == kUserException::USER_IS_BLOCKED) {
                                 $this->addError(APIErrors::USER_IS_BLOCKED);
                                 return null;
                             } else {
                                 $this->addError(APIErrors::INTERNAL_SERVERL_ERROR);
                                 return null;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$adminKuser || !$adminKuser->getIsAdmin()) {
         $this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
         return null;
     }
     if ($partner_id && $partner_id != $adminKuser->getPartnerId()) {
         $this->addError(APIErrors::UNKNOWN_PARTNER_ID);
         return;
     }
     $partner = PartnerPeer::retrieveByPK($adminKuser->getPartnerId());
     if (!$partner) {
         $this->addError(APIErrors::UNKNOWN_PARTNER_ID);
         return;
     }
     $partner_id = $partner->getId();
     $subp_id = $partner->getSubpId();
     $admin_puser_id = $adminKuser->getPuserId();
     // get the puser_kuser for this admin if exists, if not - creae it and return it - create a kuser too
     $puser_kuser = PuserKuserPeer::createPuserKuser($partner_id, $subp_id, $admin_puser_id, $adminKuser->getScreenName(), $adminKuser->getScreenName(), true);
     $uid = $puser_kuser->getPuserId();
     $ks = null;
     // create a ks for this admin_kuser as if entered the admin_secret using the API
     // ALLOW A KS FOR 30 DAYS
     kSessionUtils::createKSessionNoValidations($partner_id, $uid, $ks, 30 * 86400, 2, "", "*");
     $this->addMsg("partner_id", $partner_id);
     $this->addMsg("subp_id", $subp_id);
     $this->addMsg("uid", $uid);
     $this->addMsg("ks", $ks);
     $this->addMsg("screenName", $adminKuser->getFullName());
     $this->addMsg("fullName", $adminKuser->getFullName());
     $this->addMsg("email", $adminKuser->getEmail());
 }
开发者ID:DBezemer,项目名称:server,代码行数:85,代码来源:adminloginAction.class.php

示例15: listAction

 /**
  * List all categories
  * 
  * @action list
  * @param KalturaCategoryUserFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaCategoryUserListResponse
  * @throws KalturaErrors::MUST_FILTER_USERS_OR_CATEGORY
  */
 function listAction(KalturaCategoryUserFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!($filter->categoryIdEqual || $filter->categoryIdIn || $filter->userIdIn || $filter->userIdEqual)) {
         throw new KalturaAPIException(KalturaErrors::MUST_FILTER_USERS_OR_CATEGORY);
     }
     if (!$filter) {
         $filter = new KalturaCategoryUserFilter();
     }
     if (!$pager) {
         $pager = new kalturaFilterPager();
     }
     if ($filter->userIdIn) {
         $usersIds = explode(',', $filter->userIdIn);
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         $c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
         $kusers = kuserPeer::doSelect($c);
         $usersIds = array();
         foreach ($kusers as $kuser) {
             $usersIds[] = $kuser->getId();
         }
         $filter->userIdIn = implode(',', $usersIds);
     }
     if ($filter->userIdEqual) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $filter->userIdEqual);
         $c->add(kuserPeer::STATUS, KuserStatus::ACTIVE);
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = kuserPeer::doSelectOne($c);
         kuserPeer::setUseCriteriaFilter(true);
         //batch should be abke to get categoryUser of deleted users.
         if (!$kuser || $kuser->getStatus() != KuserStatus::ACTIVE && kCurrentContext::$ks_partner_id != Partner::BATCH_PARTNER_ID) {
             KalturaLog::debug('User not found');
             $response = new KalturaCategoryUserListResponse();
             $response->objects = new KalturaCategoryUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $filter->userIdEqual = $kuser->getId();
     }
     $categories = array();
     if ($filter->categoryIdEqual) {
         $categories[] = categoryPeer::retrieveByPK($filter->categoryIdEqual);
     } elseif ($filter->categoryIdIn) {
         $categories = categoryPeer::retrieveByPKs(explode(',', $filter->categoryIdIn));
     }
     $categoriesInheritanceRoot = array();
     foreach ($categories as $category) {
         if (is_null($category)) {
             continue;
         }
         if ($category->getInheritanceType() == InheritanceType::INHERIT) {
             if ($filter->categoryDirectMembers && kCurrentContext::$master_partner_id == Partner::BATCH_PARTNER_ID) {
                 $categoriesInheritanceRoot[$category->getId()] = $category->getId();
             } else {
                 //if category inheris members - change filter to -> inherited from parent id = category->getIheritedParent
                 $categoriesInheritanceRoot[$category->getInheritedParentId()] = $category->getInheritedParentId();
             }
         } else {
             $categoriesInheritanceRoot[$category->getId()] = $category->getId();
         }
     }
     $filter->categoryDirectMembers = null;
     $filter->categoryIdEqual = null;
     $filter->categoryIdIn = implode(',', $categoriesInheritanceRoot);
     //if filter had categories that doesn't exists or not entitled - should return 0 objects.
     if (count($categories) && !count($categoriesInheritanceRoot)) {
         $response = new KalturaCategoryUserListResponse();
         $response->totalCount = 0;
         return $response;
     }
     $categoryKuserFilter = new categoryKuserFilter();
     $filter->toObject($categoryKuserFilter);
     $c = KalturaCriteria::create(categoryKuserPeer::OM_CLASS);
     $categoryKuserFilter->attachToCriteria($c);
     $c->applyFilters();
     $totalCount = categoryKuserPeer::doCount($c);
     $pager->attachToCriteria($c);
     $list = categoryKuserPeer::doSelect($c);
     $newList = KalturaCategoryUserArray::fromDbArray($list);
     $response = new KalturaCategoryUserListResponse();
     $response->objects = $newList;
     $response->totalCount = $totalCount;
     return $response;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:97,代码来源:CategoryUserService.php


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