本文整理匯總了PHP中Piwik\Plugins\UsersManager\API::getUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP API::getUser方法的具體用法?PHP API::getUser怎麽用?PHP API::getUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Plugins\UsersManager\API
的用法示例。
在下文中一共展示了API::getUser方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$login = $input->getArgument('login');
$user = $this->usersManagerApi->getUser($login);
if (!UserMapper::isUserLdapUser($user)) {
throw new Exception("User '{$login}' is not an LDAP user. To regenerate this user's token_auth, change the user's password.");
}
if (!$this->userMapper->isRandomTokenAuthGenerationEnabled()) {
throw new Exception("Random token_auth generation is disabled in [LoginLdap] config. This means any changes made by this " . "command will be overwritten when the user logs in. Aborting.");
}
$newPassword = $this->userMapper->generateRandomPassword();
$this->usersManagerApi->updateUser($login, $newPassword, $email = false, $alias = false, $isPasswordHash = true);
$user = $this->usersManagerApi->getUser($login);
$this->writeSuccessMessage($output, array("token_auth for '{$login}' regenerated successfully, new token_auth = '{$user['token_auth']}'"));
}
示例2: test_updateUser
public function test_updateUser()
{
$this->api->updateUser($this->login, 'newPassword', 'email@example.com', 'newAlias', false);
$user = $this->api->getUser($this->login);
$this->assertSame('14a88b9d2f52c55b5fbcf9c5d9c11875', $user['password']);
$this->assertSame('email@example.com', $user['email']);
$this->assertSame('newAlias', $user['alias']);
}
示例3: test_GetUser
/**
* normal case
*/
public function test_GetUser()
{
$login = "geggeq55eqag";
$password = "mypassword";
$email = "mgeag4544i@geq.com";
$alias = "";
$this->api->addUser($login, $password, $email, $alias);
$user = $this->api->getUser($login);
// check that all fields are the same
$this->assertEquals($login, $user['login']);
$this->assertInternalType('string', $user['password']);
$this->assertInternalType('string', $user['date_registered']);
$this->assertEquals($email, $user['email']);
//alias shouldnt be empty even if no alias specified
$this->assertGreaterThan(0, strlen($user['alias']));
}