From 2f138d0501887fd0aca0f8536176f092880f662c Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 24 May 2012 12:10:47 -0700 Subject: [PATCH] Add a "roles" array to user.query Summary: - Add "role" information, so clients can identify disabled users. - Formally deprecate `user.info` Test Plan: Ran "user.query" and "user.whoami", inspected output. Verified "user.info" appears as deprecated in method list and console. Reviewers: csilvers, btrahan Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2565 --- .../method/user/base/ConduitAPI_user_Method.php | 12 ++++++++++++ .../method/user/info/ConduitAPI_user_info_Method.php | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/applications/conduit/method/user/base/ConduitAPI_user_Method.php b/src/applications/conduit/method/user/base/ConduitAPI_user_Method.php index 3c32e7ee5f..c2f4ec0e81 100644 --- a/src/applications/conduit/method/user/base/ConduitAPI_user_Method.php +++ b/src/applications/conduit/method/user/base/ConduitAPI_user_Method.php @@ -25,12 +25,24 @@ abstract class ConduitAPI_user_Method extends ConduitAPIMethod { PhabricatorUser $user, PhabricatorUserStatus $current_status = null) { + $roles = array(); + if ($user->getIsDisabled()) { + $roles[] = 'disabled'; + } + if ($user->getIsSystemAgent()) { + $roles[] = 'agent'; + } + if ($user->getIsAdmin()) { + $roles[] = 'admin'; + } + $return = array( 'phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->loadProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'), + 'roles' => $roles, ); if ($current_status) { diff --git a/src/applications/conduit/method/user/info/ConduitAPI_user_info_Method.php b/src/applications/conduit/method/user/info/ConduitAPI_user_info_Method.php index 8f2c444ff4..323183867f 100644 --- a/src/applications/conduit/method/user/info/ConduitAPI_user_info_Method.php +++ b/src/applications/conduit/method/user/info/ConduitAPI_user_info_Method.php @@ -1,7 +1,7 @@