From 242e70eabfeda53284cf9090766f15e81b29c68e Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 21 Nov 2024 19:37:04 +0000 Subject: [PATCH] Added option to include e-mail address in user rpc call. --- src/Users/UsersRpcHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Users/UsersRpcHandler.php b/src/Users/UsersRpcHandler.php index 925fcdd..25614a2 100644 --- a/src/Users/UsersRpcHandler.php +++ b/src/Users/UsersRpcHandler.php @@ -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),