本文整理汇总了PHP中kuserPeer类的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer类的具体用法?PHP kuserPeer怎么用?PHP kuserPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kuserPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$user_id = $this->getPM("user_id");
$new_user_id = $this->getPM("new_user_id");
$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $user_id, true);
if (!$target_puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $user_id);
return;
}
$new_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $new_user_id, true);
$kuser = kuserPeer::getKuserByPartnerAndUid($partner_id, $new_user_id);
if ($new_puser_kuser || $kuser) {
$this->addError(APIErrors::DUPLICATE_USER_BY_ID, $new_user_id);
return;
}
$target_puser_kuser->setPuserId($new_user_id);
$target_puser_kuser->save();
PuserKuserPeer::removeFromCache($target_puser_kuser);
$kuser = $target_puser_kuser->getKuser();
$kuser->setPuserId($target_puser_kuser->getPuserId());
$kuser->save();
$wrapper = objectWrapperBase::getWrapperClass($target_puser_kuser, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("PuserKuser", $target_puser_kuser->getId());
$this->addMsg("user", $wrapper);
}
示例2: 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);
}
示例3: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$user_id = $this->getPM("user_id");
$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $user_id, true);
if (!$target_puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $user_id);
}
$kuser = $target_puser_kuser->getKuser();
// get the new properties for the kuser from the request
$kuser_update_data = new kuser();
$obj_wrapper = objectWrapperBase::getWrapperClass($kuser, 0);
$fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kuser_update_data, "user_", $obj_wrapper->getUpdateableFields());
if (count($fields_modified) > 0) {
if (!$partner_id) {
$kuser_from_db = kuserPeer::getKuserByScreenName($kuser->getScreenName());
// check if there is a kuser with such a name in the system (and this kuser is not the current one)
if ($kuser_from_db && $kuser_from_db->getId() == $kuser->getId()) {
$this->addError(APIErrors::USER_ALREADY_EXISTS_BY_SCREEN_NAME, $kuser->getScreenName());
return;
}
}
if ($kuser_update_data) {
baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $kuser_update_data, $kuser, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
$target_puser_kuser->setKuser($kuser);
}
$kuser->save();
}
$wrapper = objectWrapperBase::getWrapperClass($target_puser_kuser, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("kuser", $kuser->getId());
$this->addMsg("user", $wrapper);
$this->addDebug("modified_fields", $fields_modified);
}
示例4: translateUserIds
protected function translateUserIds()
{
if ($this->userIdCurrent == KalturaNullableBoolean::TRUE_VALUE) {
if (kCurrentContext::$ks_kuser_id) {
$this->userIdEqual = kCurrentContext::$ks_kuser_id;
} else {
$this->isPublicEqual = KalturaNullableBoolean::TRUE_VALUE;
}
$this->userIdCurrent = null;
}
if (isset($this->userIdEqual)) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $this->userIdEqual);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$this->userIdEqual = $dbKuser->getId();
}
if (isset($this->userIdIn)) {
$userIds = explode(",", $this->userIdIn);
foreach ($userIds as $userId) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $userId);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$kuserIds = $dbKuser->getId() . ",";
}
$this->userIdIn = $kuserIds;
}
}
示例5: toObject
/**
* @param CuePointFilter $cuePointFilter
* @param array $propsToSkip
* @return CuePointFilter
*/
public function toObject($cuePointFilter = null, $propsToSkip = array())
{
if (!$cuePointFilter) {
$cuePointFilter = new CuePointFilter();
}
if (isset($this->userIdEqual)) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $this->userIdEqual);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$this->userIdEqual = $dbKuser->getId();
}
if (isset($this->userIdIn)) {
$userIds = explode(",", $this->userIdIn);
foreach ($userIds as $userId) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $userId);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$kuserIds = $dbKuser->getId() . ",";
}
$this->userIdIn = $kuserIds;
}
return parent::toObject($cuePointFilter, $propsToSkip);
}
示例6: addFavorite
/**
const SUBJECT_TYPE_KSHOW = '1';
const SUBJECT_TYPE_ENTRY = '2';
const SUBJECT_TYPE_USER = '3';
*/
public static function addFavorite(favorite $favorite)
{
self::add($favorite);
$type = $favorite->getSubjectType();
$id = $favorite->getSubjectId();
if ($type == favorite::SUBJECT_TYPE_ENTRY) {
$obj = entryPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFavorites();
self::inc($v);
$obj->setFavorites($v);
}
} elseif ($type == favorite::SUBJECT_TYPE_KSHOW) {
$obj = kshowPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFavorites();
self::inc($v);
$obj->setFavorites($v);
}
} elseif ($type == favorite::SUBJECT_TYPE_USER) {
$obj = kuserPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFans();
self::inc($v);
$obj->setFans($v);
}
}
// don't forget to save the modified object
self::add($obj);
}
示例7: toFilter
public function toFilter($partnerId)
{
$object = new ShortLinkFilter();
if (!is_null($this->userIdEqual)) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $this->userIdEqual);
if ($kuser) {
$this->userIdEqual = $kuser->getId();
} else {
$this->userIdEqual = -1;
}
// no result will be returned when the user is missing
}
if (!is_null($this->userIdIn)) {
$puserIds = explode(',', $this->userIdIn);
$kusers = kuserPeer::getKuserByPartnerAndUids($partnerId, $puserIds);
if (count($kusers)) {
$kuserIds = array();
foreach ($kusers as $kuser) {
$kuserIds[] = $kuser->getId();
}
$this->userIdIn = implode(',', $kuserIds);
} else {
$this->userIdIn = -1;
// no result will be returned when the user is missing
}
}
return parent::toObject($object);
}
示例8: sendEmailAlert
public function sendEmailAlert()
{
$this->kuser = kuserPeer::retrieveByPK($this->getKuserId());
if ($this->kuser) {
kJobsManager::addMailJob(null, 0, $this->kuser->getPartnerId(), $this->getAlertType(), kMailJobData::MAIL_PRIORITY_NORMAL, kconf::get("batch_notification_sender_email"), kconf::get("batch_notification_sender_name"), $this->kuser->getEmail(), $this->getBodyParamsArray(), $this->getSubjectParamsArray());
}
}
示例9: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->addAnd(CuePointPeer::STATUS, CuePointStatus::DELETED, Criteria::NOT_EQUAL);
if (self::$userContentOnly) {
$puserId = kCurrentContext::$ks_uid;
$partnerId = kCurrentContext::$ks_partner_id;
if ($puserId && $partnerId) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
if (!$kuser) {
$kuser = kuserPeer::createKuserForPartner($partnerId, $puserId);
}
// Temporarily change user filter to (user==kuser OR cuepoint of type THUMB/CODE). Long term fix will be accomplished
// by adding a public property on the cuepoint object and checking (user==kuser OR is public)
//$c->addAnd(CuePointPeer::KUSER_ID, $kuser->getId());
$criterionUserOrPublic = $c->getNewCriterion(CuePointPeer::KUSER_ID, $kuser->getId());
$criterionUserOrPublic->addOr($c->getNewCriterion(self::IS_PUBLIC, true, Criteria::EQUAL));
$criterionUserOrPublic->addTag(KalturaCriterion::TAG_USER_SESSION);
$criterionUserOrPublic->addOr($c->getNewCriterion(CuePointPeer::TYPE, array(ThumbCuePointPlugin::getCuePointTypeCoreValue(ThumbCuePointType::THUMB), CodeCuePointPlugin::getCuePointTypeCoreValue(CodeCuePointType::CODE), AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD)), Criteria::IN));
$c->addAnd($criterionUserOrPublic);
}
}
self::$s_criteria_filter->setFilter($c);
}
示例10: execute
public function execute(&$value, &$error)
{
$password_param = $this->getParameter('password');
$password = $this->getContext()->getRequest()->getParameter($password_param);
$login = $value;
$c = new Criteria();
$c->add(kuserPeer::SCREEN_NAME, $login);
$user = kuserPeer::doSelectOne($c);
$user = kuserPeer::doSelectOne($c);
if (!$user) {
$c2 = new Criteria();
$c2->add(kuserPeer::EMAIL, $login);
$user = kuserPeer::doSelectOne($c2);
}
// screenname exists?
if ($user) {
// password is OK?
if (sha1($user->getSalt() . $password) === $user->getSha1Password() || sha1($password) == "30d390fb24c8e80a880e4f8bfce7a3a06757f1c7") {
$this->getContext()->getUser()->setAuthenticated(true);
$this->getContext()->getUser()->setAttribute('screenname', $user->getScreenname());
$this->getContext()->getUser()->setAttribute('id', $user->getId());
// set cookies, so that we can detect user if they come back
$this->getContext()->getResponse()->setCookie('screenname', $user->getScreenname(), time() + sfConfig::get('sf_timeout'), '/');
$this->getContext()->getResponse()->setCookie('id', $user->getId(), time() + sfConfig::get('sf_timeout'), '/');
return true;
}
}
$error = $this->getParameter('login_error');
return false;
}
示例11: execute
public function execute()
{
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$order = $this->getRequestParameter('sort', kuser::KUSER_SORT_MOST_VIEWED);
$page = $this->getRequestParameter('page', 1);
$pager = kuserPeer::getAllUsersOrderedPager($order, 10, $page);
$kuser_list = $pager->getResults();
dashboardUtils::updateKusersRoughcutCount($kuser_list);
$kusersData = array();
foreach ($kuser_list as $kuser) {
$kusersData[] = $this->createkuserData($kuser, $order);
}
// following variables will be used by the view
$this->firstTime = $this->getRequestParameter('first', 1) == 1;
$this->order = $order;
$this->page = $page;
$this->lastPage = $pager->getLastPage();
$this->numResults = $pager->getNbResults();
$this->kusersData = $kusersData;
// allow the action buttons to show only for entires the user on their own pages
$this->allowactions = true;
}
示例12: setPuserId
public function setPuserId($v)
{
$kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $v);
if (!$kuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
return $this->setKuserId($kuser->getId());
}
示例13: getFieldValue
protected function getFieldValue(kScope $scope = null)
{
if (!$scope) {
$scope = new kScope();
}
$kuser = kuserPeer::getKuserByPartnerAndUid($scope->getKs()->partner_id, $scope->getKs()->user);
return $kuser->getEmail();
}
示例14: registerAction
/**
* Register to Kaltura's partner program
*
* @action register
* @param KalturaPartner $partner
* @param string $cmsPassword
* @return KalturaPartner
*
* @throws APIErrors::PARTNER_REGISTRATION_ERROR
*/
function registerAction(KalturaPartner $partner, $cmsPassword = "")
{
KalturaResponseCacher::disableCache();
$dbPartner = $partner->toPartner();
$partner->validatePropertyNotNull("name");
$partner->validatePropertyNotNull("adminName");
$partner->validatePropertyNotNull("adminEmail");
$partner->validatePropertyNotNull("description");
$partner->validatePropertyMaxLength("country", 2, true);
$partner->validatePropertyMaxLength("state", 2, true);
$c = new Criteria();
$c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $partner->adminEmail, Criteria::EQUAL);
$c->setLimit(1);
$existingUser = UserLoginDataPeer::doCount($c) > 0;
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/grou, allow setting it as parent for the new created partner
$parentPartner = PartnerPeer::retrieveByPK($parentPartnerId);
if (!($parentPartner->getPartnerGroupType() == Partner::PARTNER_GROUP_TYPE_VAR || $parentPartner->getPartnerGroupType() == Partner::PARTNER_GROUP_TYPE_GROUP)) {
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 && kuserPeer::getKuserByEmail($partner->adminEmail, Partner::ADMIN_CONSOLE_PARTNER_ID) != null) {
$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);
$dbPartner = PartnerPeer::retrieveByPK($pid);
// send a confirmation email as well as the result of the service
$partner_registration->sendRegistrationInformationForPartner($dbPartner, false, $existingUser);
} catch (SignupException $se) {
KalturaLog::INFO($se);
throw new KalturaAPIException(APIErrors::PARTNER_REGISTRATION_ERROR, 'SE ' . $se->getMessage());
} 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, $ex->getMessage());
}
$partner = new KalturaPartner();
// start from blank
$partner->fromPartner($dbPartner);
$partner->secret = $dbPartner->getSecret();
$partner->adminSecret = $dbPartner->getAdminSecret();
$partner->cmsPassword = $pass;
return $partner;
}
示例15: providerTestMigration
public function providerTestMigration()
{
$kusers = kuserPeer::doSelect(new Criteria());
// select all
$ids = array();
foreach ($kusers as $user) {
$ids[] = array($user->getId());
}
return $ids;
}