1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Use a policy-aware query for Project typeahead

Summary: Fixes T2677. Currently, you can typeahead projects you can't see.

Test Plan: Typeahead'ed projects. Verified active projects appeared; archived did not.

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2677

Differential Revision: https://secure.phabricator.com/D5242
This commit is contained in:
epriestley 2013-03-05 14:12:11 -08:00
parent aab0fb0e74
commit c23a9c9fde

View file

@ -12,6 +12,7 @@ final class PhabricatorTypeaheadCommonDatasourceController
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$query = $request->getStr('q');
$need_rich_data = false;
@ -199,9 +200,10 @@ final class PhabricatorTypeaheadCommonDatasourceController
}
if ($need_projs) {
$projs = id(new PhabricatorProject())->loadAllWhere(
'status != %d',
PhabricatorProjectStatus::STATUS_ARCHIVED);
$projs = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withStatus(PhabricatorProjectQuery::STATUS_OPEN)
->execute();
foreach ($projs as $proj) {
$results[] = id(new PhabricatorTypeaheadResult())
->setName($proj->getName())