From 99a40ab6664ec7deaad397d3845b66a729446868 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 9 Feb 2011 22:40:27 -0800 Subject: [PATCH] Fix differential.find and the web API for the conduit console Summary: differential.find was fataling in the console because of a bad constant, and you couldn't submit requests requiring authentication because the auth stuff didn't know to look for web sessions. Resolve these issues. Test Plan: Hit differential.find successfully, ran a user.find query from the web console without issues. Reviewers: tomo CC: Differential Revision: 31 --- .../controller/api/PhabricatorConduitAPIController.php | 9 ++++++--- .../find/ConduitAPI_differential_find_Method.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/applications/conduit/controller/api/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/api/PhabricatorConduitAPIController.php index 5b00396236..2c9f81692a 100644 --- a/src/applications/conduit/controller/api/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/api/PhabricatorConduitAPIController.php @@ -81,7 +81,11 @@ class PhabricatorConduitAPIController $api_request = new ConduitAPIRequest($params); - if ($method_handler->shouldRequireAuthentication()) { + if ($request->getUser()->getPHID()) { + $auth_okay = true; + } else if (!$method_handler->shouldRequireAuthentication()) { + $auth_okay = true; + } else { $session_key = idx($metadata, 'sessionKey'); if (!$session_key) { $auth_okay = false; @@ -97,6 +101,7 @@ class PhabricatorConduitAPIController $session_key); if (!$session) { $auth_okay = false; + $result = null; $error_code = 'ERR-INVALID-SESSION'; $error_info = 'Session key is invalid.'; } else { @@ -105,8 +110,6 @@ class PhabricatorConduitAPIController } } // TODO: When we session, read connectionID from the session table. - } else { - $auth_okay = true; } if ($auth_okay) { diff --git a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php index 4632f39808..fc4b986f1e 100644 --- a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php +++ b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php @@ -27,7 +27,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { DifferentialRevisionListData::QUERY_OPEN_OWNED, DifferentialRevisionListData::QUERY_COMMITTABLE, DifferentialRevisionListData::QUERY_REVISION_IDS, - DifferentialRevisionListData::QUERY_BY_PHID, + DifferentialRevisionListData::QUERY_PHIDS, ); $types = implode(', ', $types);