Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Paste
P14
Include email address in Conduit's user.query output when run by admin
Active
Public
Actions
Authored by
aklapper
on Jun 13 2023, 13:32.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Tags
None
Referenced Files
F309745: Include email address in Conduit's user.query output when run by admin
Jun 13 2023, 13:32
2023-06-13 13:32:16 (UTC+0)
Subscribers
None
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;
}
Event Timeline
aklapper
created this paste.
Jun 13 2023, 13:32
2023-06-13 13:32:16 (UTC+0)
aklapper
created this object in space
S1 Public
.
aklapper
mentioned this in
T15470: Include user email address in Conduit output when query is run by admin
.
Log In to Comment