Compare commits
No commits in common. "master" and "20241114.1" have entirely different histories.
master
...
20241114.1
1 changed files with 16 additions and 21 deletions
|
@ -19,7 +19,7 @@ final class UsersRpcHandler implements RpcHandler {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
#[RpcQuery('misuzu:users:getUser')]
|
#[RpcQuery('misuzu:users:getUser')]
|
||||||
public function queryGetUser(string $userId, bool $includeEMailAddress = false): array {
|
public function queryGetUser(string $userId): array {
|
||||||
try {
|
try {
|
||||||
$userInfo = $this->usersCtx->getUserInfo($userId, Users::GET_USER_ID);
|
$userInfo = $this->usersCtx->getUserInfo($userId, Users::GET_USER_ID);
|
||||||
} catch(RuntimeException) {
|
} catch(RuntimeException) {
|
||||||
|
@ -53,38 +53,33 @@ final class UsersRpcHandler implements RpcHandler {
|
||||||
|
|
||||||
$avatars = array_reverse($avatars);
|
$avatars = array_reverse($avatars);
|
||||||
|
|
||||||
$output = [];
|
$output = [
|
||||||
|
'id' => $userInfo->getId(),
|
||||||
|
'name' => $userInfo->getName(),
|
||||||
|
'colour_raw' => $colourRaw,
|
||||||
|
'colour_css' => $colourCSS,
|
||||||
|
'rank' => $rank,
|
||||||
|
'country_code' => $userInfo->getCountryCode(),
|
||||||
|
'avatar_urls' => $avatars,
|
||||||
|
'profile_url' => $baseUrl . $this->urls->format('user-profile', ['user' => $userInfo->getId()]),
|
||||||
|
'created_at' => $userInfo->getCreatedAt()->toIso8601ZuluString(),
|
||||||
|
];
|
||||||
|
|
||||||
$output['id'] = $userInfo->getId();
|
if($userInfo->hasLastActive())
|
||||||
$output['name'] = $userInfo->getName();
|
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
|
||||||
if($includeEMailAddress)
|
|
||||||
$output['email'] = $userInfo->getEMailAddress();
|
|
||||||
|
|
||||||
$output['colour_raw'] = $colourRaw;
|
|
||||||
$output['colour_css'] = $colourCSS;
|
|
||||||
$output['rank'] = $rank;
|
|
||||||
$output['country_code'] = $userInfo->getCountryCode();
|
|
||||||
|
|
||||||
$roles = XArray::select(
|
$roles = XArray::select(
|
||||||
$this->usersCtx->getRoles()->getRoles(userInfo: $userInfo, hasString: true, orderByRank: true),
|
$this->usersCtx->getRoles()->getRoles(userInfo: $userInfo, hasString: true, orderByRank: true),
|
||||||
fn($roleInfo) => $roleInfo->getString(),
|
fn($roleInfo) => $roleInfo->getString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!empty($roles))
|
if(!empty($roles))
|
||||||
$output['roles'] = $roles;
|
$output['roles'] = $roles;
|
||||||
if($userInfo->isSuperUser())
|
|
||||||
$output['is_super'] = true;
|
|
||||||
|
|
||||||
if($userInfo->hasTitle())
|
if($userInfo->hasTitle())
|
||||||
$output['title'] = $userInfo->getTitle();
|
$output['title'] = $userInfo->getTitle();
|
||||||
|
|
||||||
$output['created_at'] = $userInfo->getCreatedAt()->toIso8601ZuluString();
|
if($userInfo->isSuperUser())
|
||||||
if($userInfo->hasLastActive())
|
$output['is_super'] = true;
|
||||||
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
|
|
||||||
|
|
||||||
$output['profile_url'] = $baseUrl . $this->urls->format('user-profile', ['user' => $userInfo->getId()]);
|
|
||||||
$output['avatar_urls'] = $avatars;
|
|
||||||
|
|
||||||
if($userInfo->isDeleted())
|
if($userInfo->isDeleted())
|
||||||
$output['is_deleted'] = true;
|
$output['is_deleted'] = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue