本文整理汇总了PHP中kuserPeer::getKuserByScreenName方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::getKuserByScreenName方法的具体用法?PHP kuserPeer::getKuserByScreenName怎么用?PHP kuserPeer::getKuserByScreenName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::getKuserByScreenName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: getAuthData
/**
*/
public function getAuthData($kuserId, $userName, $password, $token)
{
$status = 'error';
$message = '';
$authData = null;
$kuser = kuserPeer::getKuserByScreenName($userName);
if ($kuser) {
if ($kuser->isPasswordValid($password)) {
$authData = self::createHashString($kuser->getId());
$status = "ok";
}
}
return array('status' => $status, 'message' => $message, 'authData' => $authData);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:myKalturaKshowServices.class.php
示例3: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$target_puser_id = $this->getPM("user_id");
$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $target_puser_id);
if ($target_puser_kuser) {
$this->addDebug("puser_exists", $target_puser_kuser->getId());
// might be that the puser_kuser exists but the kuser does not
$kuser = kuserPeer::retrieveByPK($target_puser_kuser->getKuserId());
if ($kuser) {
$this->addError(APIErrors::DUPLICATE_USER_BY_ID, $target_puser_id);
return;
} else {
// puser_kuser exists but need to create the ksuer...
}
} else {
$target_puser_kuser = new PuserKuser();
$target_puser_kuser->setPuserId($target_puser_id);
$target_puser_kuser->setPartnerId($partner_id);
$target_puser_kuser->save();
$this->addDebug("Created_new_puser_kuser", $target_puser_kuser->getId());
}
// get the new properties for the kuser from the request
$kuser = new kuser();
$obj_wrapper = objectWrapperBase::getWrapperClass($kuser, 0);
$fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kuser, "user_", $obj_wrapper->getUpdateableFields());
// check that mandatory fields were set
// TODO
if (count($fields_modified) > 0) {
if (!$partner_id) {
$kuser_from_db = kuserPeer::getKuserByScreenName($kuser->getScreenName());
if ($kuser_from_db) {
$this->addError(APIErrors::DUPLICATE_USER_BY_SCREEN_NAME, $kuser->getScreenName());
return;
}
}
$kuser->setPartnerId($partner_id);
$kuser->setPuserId($target_puser_id);
try {
$kuser = kuserPeer::addUser($kuser);
} catch (kUserException $e) {
$code = $e->getCode();
if ($code == kUserException::USER_ALREADY_EXISTS) {
$this->addException(APIErrors::DUPLICATE_USER_BY_ID, $kuser->getId());
return null;
}
if ($code == kUserException::LOGIN_ID_ALREADY_USED) {
$this->addException(APIErrors::DUPLICATE_USER_BY_LOGIN_ID, $kuser->getEmail());
return null;
} else {
if ($code == kUserException::USER_ID_MISSING) {
$this->addException(APIErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'id');
return null;
} else {
if ($code == kUserException::INVALID_EMAIL) {
$this->addException(APIErrors::INVALID_FIELD_VALUE);
return null;
} else {
if ($code == kUserException::INVALID_PARTNER) {
$this->addException(APIErrors::UNKNOWN_PARTNER_ID);
return null;
} else {
if ($code == kUserException::ADMIN_LOGIN_USERS_QUOTA_EXCEEDED) {
$this->addException(APIErrors::ADMIN_LOGIN_USERS_QUOTA_EXCEEDED);
return null;
} else {
if ($code == kUserException::PASSWORD_STRUCTURE_INVALID) {
$this->addException(APIErrors::PASSWORD_STRUCTURE_INVALID);
return null;
}
}
}
}
}
}
throw $e;
} catch (kPermissionException $e) {
$code = $e->getCode();
if ($code == kPermissionException::ROLE_ID_MISSING) {
$this->addException(APIErrors::ROLE_ID_MISSING);
return null;
}
if ($code == kPermissionException::ONLY_ONE_ROLE_PER_USER_ALLOWED) {
$this->addException(APIErrors::ONLY_ONE_ROLE_PER_USER_ALLOWED);
return null;
}
throw $e;
}
// now update the puser_kuser
$target_puser_kuser->setPuserName($kuser->getScreenName());
$target_puser_kuser->setKuserId($kuser->getId());
$target_puser_kuser->save();
$this->addMsg("user", objectWrapperBase::getWrapperClass($target_puser_kuser, objectWrapperBase::DETAIL_LEVEL_DETAILED));
$this->addDebug("added_fields", $fields_modified);
} else {
$this->addError(APIErrors::NO_FIELDS_SET_FOR_USER);
}
}