Page MenuHomePhorge

Include email address in Conduit's user.query output when run by admin

Authored By
aklapper
Jun 13 2023, 13:32
Size
1 KB
Referenced Files
None
Subscribers
None

Include email address in Conduit's user.query output when run by admin

diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
index df0ec65841..0a99ab437e 100644
--- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
@@ -80,11 +80,22 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod {
$users = $query->execute();
$results = array();
+
+ $actor = $request->getUser();
+ $is_admin = $actor->getIsAdmin();
+
foreach ($users as $user) {
- $results[] = $this->buildUserInformationDictionary(
- $user,
- $with_email = false,
- $with_availability = true);
+ if ($is_admin) {
+ $results[] = $this->buildUserInformationDictionary(
+ $user,
+ $with_email = true,
+ $with_availability = true);
+ } else {
+ $results[] = $this->buildUserInformationDictionary(
+ $user,
+ $with_email = false,
+ $with_availability = true);
+ }
}
return $results;
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
209837
Default Alt Text
Include email address in Conduit's user.query output when run by admin (1 KB)

Event Timeline