本文整理汇总了PHP中UserAccount::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::getById方法的具体用法?PHP UserAccount::getById怎么用?PHP UserAccount::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::getById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCallApiOperationWithGrants
public function testCallApiOperationWithGrants()
{
TestsHelper::dbFixture(\UserAccount::getTableName(), array(array('login' => 'test', 'password' => passwordColumn::hash('testtest'))));
$user = \UserAccount::getById(1);
\ACL::create(TestApiWithACLOperation::RightName);
\ACL::grant(TestApiWithACLOperation::RightName, $user->obj_rights->getEntity());
\UsersLogin::login('test', 'testtest');
$method = new TestApiWithACLOperation();
$this->assertTrue($method->exec());
}
示例2: resetPassword
public function resetPassword($userId, $code)
{
$user = UserAccount::getById($userId);
if ($user->password->getValue() == $code) {
UsersForgot::resetPassword($user);
$this->addAlert('Пароль выслан');
} else {
$this->addAlert('Токен не найден');
}
$this->jump('/');
}
示例3: getByUID
public static function getByUID($uid, $network)
{
$network = Network::getByName($network);
$found = DBSimple::get(self::UIDTable, ['uid' => $uid, 'network_id' => $network->id->getValue()]);
if (empty($found)) {
throw new SocialNetworksException('UID not found');
}
$user = \UserAccount::getById($found['user_id']);
return $user;
}
示例4: signup
/**
*
* @param unknown $login
* @param unknown $password
* @param unknown $email
*
* @throws Exception
*/
public function signup($login, $password, $email)
{
try {
self::testCaptcha(isset($_POST['kcaptcha']) ? $_POST['kcaptcha'] : '');
$userId = UsersRegistration::signup($login, $password, $email, $_POST);
$user = \UserAccount::getById($userId);
$avatar = $this->acceptFile('avatar');
if (!empty($avatar)) {
$user->avatar->copyFrom($avatar);
$user->update();
if (file_exists($avatar)) {
unlink($avatar);
}
}
$this->jump('/signup/?success=1');
} catch (Exception $e) {
CMSLog::addMessage('registration', $e);
$this->main($_POST, $e->getMessage());
}
}
示例5: getCurrentSession
/**
* @return UserAccount
*/
public static function getCurrentSession()
{
if (!empty(self::$currentUser)) {
return self::$currentUser;
} elseif (!empty(self::$session)) {
try {
self::$currentUser = UserAccount::getById(self::$session['id']);
} catch (\NotFoundException $e) {
self::unsetSession();
throw $e;
}
return self::$currentUser;
}
return null;
}