mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
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
This commit is contained in:
parent
e8e185ceb3
commit
99a40ab666
2 changed files with 7 additions and 4 deletions
|
@ -81,7 +81,11 @@ class PhabricatorConduitAPIController
|
||||||
|
|
||||||
$api_request = new ConduitAPIRequest($params);
|
$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');
|
$session_key = idx($metadata, 'sessionKey');
|
||||||
if (!$session_key) {
|
if (!$session_key) {
|
||||||
$auth_okay = false;
|
$auth_okay = false;
|
||||||
|
@ -97,6 +101,7 @@ class PhabricatorConduitAPIController
|
||||||
$session_key);
|
$session_key);
|
||||||
if (!$session) {
|
if (!$session) {
|
||||||
$auth_okay = false;
|
$auth_okay = false;
|
||||||
|
$result = null;
|
||||||
$error_code = 'ERR-INVALID-SESSION';
|
$error_code = 'ERR-INVALID-SESSION';
|
||||||
$error_info = 'Session key is invalid.';
|
$error_info = 'Session key is invalid.';
|
||||||
} else {
|
} else {
|
||||||
|
@ -105,8 +110,6 @@ class PhabricatorConduitAPIController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: When we session, read connectionID from the session table.
|
// TODO: When we session, read connectionID from the session table.
|
||||||
} else {
|
|
||||||
$auth_okay = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($auth_okay) {
|
if ($auth_okay) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod {
|
||||||
DifferentialRevisionListData::QUERY_OPEN_OWNED,
|
DifferentialRevisionListData::QUERY_OPEN_OWNED,
|
||||||
DifferentialRevisionListData::QUERY_COMMITTABLE,
|
DifferentialRevisionListData::QUERY_COMMITTABLE,
|
||||||
DifferentialRevisionListData::QUERY_REVISION_IDS,
|
DifferentialRevisionListData::QUERY_REVISION_IDS,
|
||||||
DifferentialRevisionListData::QUERY_BY_PHID,
|
DifferentialRevisionListData::QUERY_PHIDS,
|
||||||
);
|
);
|
||||||
|
|
||||||
$types = implode(', ', $types);
|
$types = implode(', ', $types);
|
||||||
|
|
Loading…
Reference in a new issue