Added option to include e-mail address in user rpc call.

This commit is contained in:
Pachira 2024-11-21 19:37:04 +00:00
parent 174ceaa4e7
commit 242e70eabf

View file

@ -19,7 +19,7 @@ final class UsersRpcHandler implements RpcHandler {
) {}
#[RpcQuery('misuzu:users:getUser')]
public function queryGetUser(string $userId): array {
public function queryGetUser(string $userId, bool $includeEMailAddress = false): array {
try {
$userInfo = $this->usersCtx->getUserInfo($userId, Users::GET_USER_ID);
} catch(RuntimeException) {
@ -65,8 +65,11 @@ final class UsersRpcHandler implements RpcHandler {
'created_at' => $userInfo->getCreatedAt()->toIso8601ZuluString(),
];
if($includeEMailAddress)
$output['email'] = $userInfo->getEMailAddress();
if($userInfo->hasLastActive())
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
$output['last_active_at'] = $userInfo->getLastActiveAt()->toIso8601ZuluString();
$roles = XArray::select(
$this->usersCtx->getRoles()->getRoles(userInfo: $userInfo, hasString: true, orderByRank: true),