Page MenuHomePhabricator

D7367.diff

diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
--- a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
@@ -96,4 +96,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationAuth';
+ }
+
}
diff --git a/src/applications/auth/query/PhabricatorExternalAccountQuery.php b/src/applications/auth/query/PhabricatorExternalAccountQuery.php
--- a/src/applications/auth/query/PhabricatorExternalAccountQuery.php
+++ b/src/applications/auth/query/PhabricatorExternalAccountQuery.php
@@ -163,4 +163,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPeople';
+ }
+
}
diff --git a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php
--- a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php
+++ b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php
@@ -55,4 +55,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationChatlog';
+ }
+
}
diff --git a/src/applications/chatlog/PhabricatorChatLogQuery.php b/src/applications/chatlog/PhabricatorChatLogQuery.php
--- a/src/applications/chatlog/PhabricatorChatLogQuery.php
+++ b/src/applications/chatlog/PhabricatorChatLogQuery.php
@@ -54,4 +54,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationChatlog';
+ }
+
}
diff --git a/src/applications/conduit/query/PhabricatorConduitLogQuery.php b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
--- a/src/applications/conduit/query/PhabricatorConduitLogQuery.php
+++ b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
@@ -40,4 +40,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationConduit';
+ }
+
}
diff --git a/src/applications/conduit/query/PhabricatorConduitMethodQuery.php b/src/applications/conduit/query/PhabricatorConduitMethodQuery.php
--- a/src/applications/conduit/query/PhabricatorConduitMethodQuery.php
+++ b/src/applications/conduit/query/PhabricatorConduitMethodQuery.php
@@ -121,4 +121,8 @@
return $methods;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationConduit';
+ }
+
}
diff --git a/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php b/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php
--- a/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php
+++ b/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php
@@ -16,15 +16,12 @@
return new PhabricatorConfigEntry();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorConfigEntryQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/config/query/PhabricatorConfigEntryQuery.php b/src/applications/config/query/PhabricatorConfigEntryQuery.php
--- a/src/applications/config/query/PhabricatorConfigEntryQuery.php
+++ b/src/applications/config/query/PhabricatorConfigEntryQuery.php
@@ -53,4 +53,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationConfig';
+ }
+
}
diff --git a/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php b/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php
--- a/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php
+++ b/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php
@@ -19,15 +19,12 @@
return new ConpherenceThread();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ConpherenceThreadQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php
--- a/src/applications/conpherence/query/ConpherenceThreadQuery.php
+++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php
@@ -282,4 +282,8 @@
return $this;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationConpherence';
+ }
+
}
diff --git a/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php b/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php
--- a/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php
+++ b/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php
@@ -16,15 +16,12 @@
return new PhabricatorCountdown();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorCountdownQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/countdown/query/PhabricatorCountdownQuery.php b/src/applications/countdown/query/PhabricatorCountdownQuery.php
--- a/src/applications/countdown/query/PhabricatorCountdownQuery.php
+++ b/src/applications/countdown/query/PhabricatorCountdownQuery.php
@@ -85,4 +85,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationCountdown';
+ }
+
}
diff --git a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
--- a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
+++ b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php
@@ -142,4 +142,8 @@
}
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDaemons';
+ }
+
}
diff --git a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
--- a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
+++ b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php
@@ -16,15 +16,12 @@
return new DifferentialRevision();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new DifferentialRevisionQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/differential/query/DifferentialDiffQuery.php b/src/applications/differential/query/DifferentialDiffQuery.php
--- a/src/applications/differential/query/DifferentialDiffQuery.php
+++ b/src/applications/differential/query/DifferentialDiffQuery.php
@@ -137,4 +137,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDifferential';
+ }
+
}
diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php
--- a/src/applications/differential/query/DifferentialRevisionQuery.php
+++ b/src/applications/differential/query/DifferentialRevisionQuery.php
@@ -1189,7 +1189,8 @@
) + array_fuse($project_authority);
}
-
-
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDifferential';
+ }
}
diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php
--- a/src/applications/diffusion/query/DiffusionCommitQuery.php
+++ b/src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -250,4 +250,8 @@
}
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDiffusion';
+ }
+
}
diff --git a/src/applications/diviner/phid/DivinerPHIDTypeAtom.php b/src/applications/diviner/phid/DivinerPHIDTypeAtom.php
--- a/src/applications/diviner/phid/DivinerPHIDTypeAtom.php
+++ b/src/applications/diviner/phid/DivinerPHIDTypeAtom.php
@@ -16,15 +16,12 @@
return new DivinerLiveSymbol();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new DivinerAtomQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/diviner/phid/DivinerPHIDTypeBook.php b/src/applications/diviner/phid/DivinerPHIDTypeBook.php
--- a/src/applications/diviner/phid/DivinerPHIDTypeBook.php
+++ b/src/applications/diviner/phid/DivinerPHIDTypeBook.php
@@ -16,15 +16,12 @@
return new DivinerLiveBook();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new DivinerBookQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/diviner/query/DivinerAtomQuery.php b/src/applications/diviner/query/DivinerAtomQuery.php
--- a/src/applications/diviner/query/DivinerAtomQuery.php
+++ b/src/applications/diviner/query/DivinerAtomQuery.php
@@ -405,4 +405,8 @@
}
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDiviner';
+ }
+
}
diff --git a/src/applications/diviner/query/DivinerBookQuery.php b/src/applications/diviner/query/DivinerBookQuery.php
--- a/src/applications/diviner/query/DivinerBookQuery.php
+++ b/src/applications/diviner/query/DivinerBookQuery.php
@@ -66,4 +66,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDiviner';
+ }
+
}
diff --git a/src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php b/src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php
--- a/src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php
+++ b/src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php
@@ -52,4 +52,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDoorkeeper';
+ }
+
}
diff --git a/src/applications/feed/query/PhabricatorFeedQuery.php b/src/applications/feed/query/PhabricatorFeedQuery.php
--- a/src/applications/feed/query/PhabricatorFeedQuery.php
+++ b/src/applications/feed/query/PhabricatorFeedQuery.php
@@ -104,4 +104,9 @@
return $item['chronologicalKey'];
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationFeed';
+ }
+
}
diff --git a/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php b/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php
--- a/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php
+++ b/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php
@@ -16,15 +16,12 @@
return new PhabricatorFile();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorFileQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/files/query/PhabricatorFileQuery.php b/src/applications/files/query/PhabricatorFileQuery.php
--- a/src/applications/files/query/PhabricatorFileQuery.php
+++ b/src/applications/files/query/PhabricatorFileQuery.php
@@ -235,4 +235,9 @@
return 'f.id';
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationFiles';
+ }
+
}
diff --git a/src/applications/flag/query/PhabricatorFlagQuery.php b/src/applications/flag/query/PhabricatorFlagQuery.php
--- a/src/applications/flag/query/PhabricatorFlagQuery.php
+++ b/src/applications/flag/query/PhabricatorFlagQuery.php
@@ -160,4 +160,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationFlags';
+ }
+
}
diff --git a/src/applications/herald/phid/HeraldPHIDTypeRule.php b/src/applications/herald/phid/HeraldPHIDTypeRule.php
--- a/src/applications/herald/phid/HeraldPHIDTypeRule.php
+++ b/src/applications/herald/phid/HeraldPHIDTypeRule.php
@@ -16,15 +16,12 @@
return new HeraldRule();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new HeraldRuleQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/herald/query/HeraldRuleQuery.php b/src/applications/herald/query/HeraldRuleQuery.php
--- a/src/applications/herald/query/HeraldRuleQuery.php
+++ b/src/applications/herald/query/HeraldRuleQuery.php
@@ -229,4 +229,9 @@
}
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationHerald';
+ }
+
}
diff --git a/src/applications/herald/query/HeraldTranscriptQuery.php b/src/applications/herald/query/HeraldTranscriptQuery.php
--- a/src/applications/herald/query/HeraldTranscriptQuery.php
+++ b/src/applications/herald/query/HeraldTranscriptQuery.php
@@ -94,5 +94,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationHerald';
+ }
}
diff --git a/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php b/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php
--- a/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php
+++ b/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php
@@ -19,16 +19,13 @@
return new LegalpadDocument();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new LegalpadDocumentQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
->withPHIDs($phids)
- ->needDocumentBodies(true)
- ->execute();
+ ->needDocumentBodies(true);
}
public function loadHandles(
diff --git a/src/applications/legalpad/query/LegalpadDocumentQuery.php b/src/applications/legalpad/query/LegalpadDocumentQuery.php
--- a/src/applications/legalpad/query/LegalpadDocumentQuery.php
+++ b/src/applications/legalpad/query/LegalpadDocumentQuery.php
@@ -181,5 +181,8 @@
return $documents;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationLegalpad';
+ }
}
diff --git a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
--- a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
+++ b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
@@ -16,15 +16,12 @@
return new PhabricatorFileImageMacro();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorMacroQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/macro/query/PhabricatorMacroQuery.php b/src/applications/macro/query/PhabricatorMacroQuery.php
--- a/src/applications/macro/query/PhabricatorMacroQuery.php
+++ b/src/applications/macro/query/PhabricatorMacroQuery.php
@@ -216,4 +216,8 @@
return 'm.id';
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationMacro';
+ }
+
}
diff --git a/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php b/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php
--- a/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php
+++ b/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php
@@ -16,15 +16,12 @@
return new PhabricatorMetaMTAMailingList();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorMailingListQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/mailinglists/query/PhabricatorMailingListQuery.php b/src/applications/mailinglists/query/PhabricatorMailingListQuery.php
--- a/src/applications/mailinglists/query/PhabricatorMailingListQuery.php
+++ b/src/applications/mailinglists/query/PhabricatorMailingListQuery.php
@@ -53,4 +53,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationMailingLists';
+ }
+
}
diff --git a/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php b/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php
--- a/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php
+++ b/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php
@@ -16,15 +16,12 @@
return new ManiphestTask();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ManiphestTaskQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -886,4 +886,9 @@
return 'task.phid';
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationManiphest';
+ }
+
}
diff --git a/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php b/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php
--- a/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php
+++ b/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php
@@ -17,15 +17,12 @@
return null;
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorApplicationQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/meta/query/PhabricatorApplicationQuery.php b/src/applications/meta/query/PhabricatorApplicationQuery.php
--- a/src/applications/meta/query/PhabricatorApplicationQuery.php
+++ b/src/applications/meta/query/PhabricatorApplicationQuery.php
@@ -132,4 +132,13 @@
return $apps;
}
+
+ public function getQueryApplicationClass() {
+ // NOTE: Although this belongs to the "Applications" application, trying
+ // to filter its results just leaves us recursing indefinitely. Users
+ // always have access to applications regardless of other policy settings
+ // anyway.
+ return null;
+ }
+
}
diff --git a/src/applications/notification/PhabricatorNotificationQuery.php b/src/applications/notification/PhabricatorNotificationQuery.php
--- a/src/applications/notification/PhabricatorNotificationQuery.php
+++ b/src/applications/notification/PhabricatorNotificationQuery.php
@@ -111,4 +111,10 @@
return $item->getChronologicalKey();
}
+
+ public function getQueryApplicationClass() {
+ // TODO: No actual "Notification" app yet, but there probably should be.
+ return null;
+ }
+
}
diff --git a/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php b/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php
--- a/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php
+++ b/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php
@@ -16,15 +16,12 @@
return new PhabricatorOwnersPackage();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorOwnersPackageQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
--- a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
+++ b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
@@ -79,4 +79,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationOwners';
+ }
+
}
diff --git a/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php b/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php
--- a/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php
+++ b/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php
@@ -16,15 +16,12 @@
return new PhabricatorPaste();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorPasteQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php
--- a/src/applications/paste/query/PhabricatorPasteQuery.php
+++ b/src/applications/paste/query/PhabricatorPasteQuery.php
@@ -249,4 +249,9 @@
}
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPaste';
+ }
+
}
diff --git a/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php b/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php
--- a/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php
+++ b/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php
@@ -16,15 +16,12 @@
return new PhabricatorExternalAccount();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorExternalAccountQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php b/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php
--- a/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php
+++ b/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php
@@ -16,17 +16,14 @@
return new PhabricatorUser();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorPeopleQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
->withPHIDs($phids)
->needProfileImage(true)
- ->needStatus(true)
- ->execute();
+ ->needStatus(true);
}
public function loadHandles(
diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php
--- a/src/applications/people/query/PhabricatorPeopleQuery.php
+++ b/src/applications/people/query/PhabricatorPeopleQuery.php
@@ -282,4 +282,8 @@
return 'user.phid';
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPeople';
+ }
+
}
diff --git a/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php b/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php
--- a/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php
+++ b/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php
@@ -19,15 +19,12 @@
return new PhameBlog();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhameBlogQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php b/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php
--- a/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php
+++ b/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php
@@ -19,15 +19,12 @@
return new PhamePost();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhamePostQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/phame/query/PhameBlogQuery.php b/src/applications/phame/query/PhameBlogQuery.php
--- a/src/applications/phame/query/PhameBlogQuery.php
+++ b/src/applications/phame/query/PhameBlogQuery.php
@@ -75,4 +75,9 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ // TODO: Can we set this without breaking public blogs?
+ return null;
+ }
+
}
diff --git a/src/applications/phame/query/PhamePostQuery.php b/src/applications/phame/query/PhamePostQuery.php
--- a/src/applications/phame/query/PhamePostQuery.php
+++ b/src/applications/phame/query/PhamePostQuery.php
@@ -141,4 +141,9 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ // TODO: Does setting this break public blogs?
+ return null;
+ }
+
}
diff --git a/src/applications/phid/query/PhabricatorHandleQuery.php b/src/applications/phid/query/PhabricatorHandleQuery.php
--- a/src/applications/phid/query/PhabricatorHandleQuery.php
+++ b/src/applications/phid/query/PhabricatorHandleQuery.php
@@ -67,4 +67,8 @@
return $results;
}
+ public function getQueryApplicationClass() {
+ return null;
+ }
+
}
diff --git a/src/applications/phid/query/PhabricatorObjectQuery.php b/src/applications/phid/query/PhabricatorObjectQuery.php
--- a/src/applications/phid/query/PhabricatorObjectQuery.php
+++ b/src/applications/phid/query/PhabricatorObjectQuery.php
@@ -152,4 +152,8 @@
return true;
}
+ public function getQueryApplicationClass() {
+ return null;
+ }
+
}
diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php
--- a/src/applications/phid/type/PhabricatorPHIDType.php
+++ b/src/applications/phid/type/PhabricatorPHIDType.php
@@ -9,12 +9,55 @@
return null;
}
- abstract public function loadObjects(
+ /**
+ * Build a @{class:PhabricatorPolicyAwareQuery} to load objects of this type
+ * by PHID.
+ *
+ * If you can not build a single query which satisfies this requirement, you
+ * can provide a dummy implementation for this method and overload
+ * @{method:loadObjects} instead.
+ *
+ * @param PhabricatorObjectQuery Query being executed.
+ * @param list<phid> PHIDs to load.
+ * @return PhabricatorPolicyAwareQuery Query object which loads the
+ * specified PHIDs when executed.
+ */
+ abstract protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids);
/**
+ * Load objects of this type, by PHID. For most PHID types, it is only
+ * necessary to implement @{method:buildQueryForObjects} to get object
+ * loading to work.
+ *
+ * @param PhabricatorObjectQuery Query being executed.
+ * @param list<phid> PHIDs to load.
+ * @return list<wild> Corresponding objects.
+ */
+ public function loadObjects(
+ PhabricatorObjectQuery $query,
+ array $phids) {
+
+ $object_query = $this->buildQueryForObjects($query, $phids)
+ ->setViewer($query->getViewer())
+ ->setParentQuery($query);
+
+ // If the user doesn't have permission to use the application at all,
+ // just mark all the PHIDs as filtered. This primarily makes these
+ // objects show up as "Restricted" instead of "Unknown" when loaded as
+ // handles, which is technically true.
+ if (!$object_query->canViewerUseQueryApplication()) {
+ $object_query->addPolicyFilteredPHIDs(array_fuse($phids));
+ return array();
+ }
+
+ return $object_query->execute();
+ }
+
+
+ /**
* Populate provided handles with application-specific data, like titles and
* URIs.
*
@@ -38,7 +81,7 @@
* @param PhabricatorHandleQuery Issuing query object.
* @param list<PhabricatorObjectHandle> Handles to populate with data.
* @param list<Object> Objects for these PHIDs loaded by
- * @{method:loadObjects()}.
+ * @{method:buildQueryForObjects()}.
* @return void
*/
abstract public function loadHandles(
diff --git a/src/applications/phlux/phid/PhluxPHIDTypeVariable.php b/src/applications/phlux/phid/PhluxPHIDTypeVariable.php
--- a/src/applications/phlux/phid/PhluxPHIDTypeVariable.php
+++ b/src/applications/phlux/phid/PhluxPHIDTypeVariable.php
@@ -16,15 +16,12 @@
return new PhluxVariable();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhluxVariableQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/phlux/query/PhluxVariableQuery.php b/src/applications/phlux/query/PhluxVariableQuery.php
--- a/src/applications/phlux/query/PhluxVariableQuery.php
+++ b/src/applications/phlux/query/PhluxVariableQuery.php
@@ -65,4 +65,8 @@
return true;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhlux';
+ }
+
}
diff --git a/src/applications/pholio/phid/PholioPHIDTypeImage.php b/src/applications/pholio/phid/PholioPHIDTypeImage.php
--- a/src/applications/pholio/phid/PholioPHIDTypeImage.php
+++ b/src/applications/pholio/phid/PholioPHIDTypeImage.php
@@ -16,15 +16,12 @@
return new PholioImage();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PholioImageQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/pholio/phid/PholioPHIDTypeMock.php b/src/applications/pholio/phid/PholioPHIDTypeMock.php
--- a/src/applications/pholio/phid/PholioPHIDTypeMock.php
+++ b/src/applications/pholio/phid/PholioPHIDTypeMock.php
@@ -16,15 +16,12 @@
return new PholioMock();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PholioMockQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/pholio/query/PholioImageQuery.php b/src/applications/pholio/query/PholioImageQuery.php
--- a/src/applications/pholio/query/PholioImageQuery.php
+++ b/src/applications/pholio/query/PholioImageQuery.php
@@ -161,4 +161,8 @@
return $images;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPholio';
+ }
+
}
diff --git a/src/applications/pholio/query/PholioMockQuery.php b/src/applications/pholio/query/PholioMockQuery.php
--- a/src/applications/pholio/query/PholioMockQuery.php
+++ b/src/applications/pholio/query/PholioMockQuery.php
@@ -161,4 +161,8 @@
}
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPholio';
+ }
+
}
diff --git a/src/applications/phortune/query/PhortuneAccountQuery.php b/src/applications/phortune/query/PhortuneAccountQuery.php
--- a/src/applications/phortune/query/PhortuneAccountQuery.php
+++ b/src/applications/phortune/query/PhortuneAccountQuery.php
@@ -95,4 +95,9 @@
return implode(' ', $joins);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhortune';
+ }
+
}
diff --git a/src/applications/phortune/query/PhortunePaymentMethodQuery.php b/src/applications/phortune/query/PhortunePaymentMethodQuery.php
--- a/src/applications/phortune/query/PhortunePaymentMethodQuery.php
+++ b/src/applications/phortune/query/PhortunePaymentMethodQuery.php
@@ -110,4 +110,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhortune';
+ }
+
}
diff --git a/src/applications/phortune/query/PhortuneProductQuery.php b/src/applications/phortune/query/PhortuneProductQuery.php
--- a/src/applications/phortune/query/PhortuneProductQuery.php
+++ b/src/applications/phortune/query/PhortuneProductQuery.php
@@ -53,4 +53,8 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhortune';
+ }
+
}
diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
--- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php
+++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
@@ -302,4 +302,9 @@
return $sum_ended['N'] + $sum_not_ended['N'];
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhrequent';
+ }
+
}
diff --git a/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php b/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php
--- a/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php
+++ b/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php
@@ -16,15 +16,12 @@
return new PhrictionDocument();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhrictionDocumentQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/phriction/query/PhrictionDocumentQuery.php b/src/applications/phriction/query/PhrictionDocumentQuery.php
--- a/src/applications/phriction/query/PhrictionDocumentQuery.php
+++ b/src/applications/phriction/query/PhrictionDocumentQuery.php
@@ -185,4 +185,9 @@
}
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPhriction';
+ }
+
}
diff --git a/src/applications/policy/__tests__/PhabricatorPolicyAwareTestQuery.php b/src/applications/policy/__tests__/PhabricatorPolicyAwareTestQuery.php
--- a/src/applications/policy/__tests__/PhabricatorPolicyAwareTestQuery.php
+++ b/src/applications/policy/__tests__/PhabricatorPolicyAwareTestQuery.php
@@ -33,4 +33,8 @@
$this->offset += count($page);
}
+ public function getQueryApplicationClass() {
+ return null;
+ }
+
}
diff --git a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php b/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
--- a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
+++ b/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
@@ -210,6 +210,22 @@
count($query->execute()));
}
+ public function testAllQueriesBelongToActualApplications() {
+ $queries = id(new PhutilSymbolLoader())
+ ->setAncestorClass('PhabricatorPolicyAwareQuery')
+ ->loadObjects();
+
+ foreach ($queries as $qclass => $query) {
+ $class = $query->getQueryApplicationClass();
+ if (!$class) {
+ continue;
+ }
+ $this->assertEqual(
+ true,
+ class_exists($class),
+ "Application class '{$class}' for query '{$qclass}'");
+ }
+ }
/**
* Test an object for visibility across multiple user specifications.
diff --git a/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php b/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php
--- a/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php
+++ b/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php
@@ -17,15 +17,12 @@
return new PhabricatorPolicy();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorPolicyQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php
--- a/src/applications/policy/query/PhabricatorPolicyQuery.php
+++ b/src/applications/policy/query/PhabricatorPolicyQuery.php
@@ -223,5 +223,10 @@
return true;
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPolicy';
+ }
+
}
diff --git a/src/applications/ponder/phid/PonderPHIDTypeAnswer.php b/src/applications/ponder/phid/PonderPHIDTypeAnswer.php
--- a/src/applications/ponder/phid/PonderPHIDTypeAnswer.php
+++ b/src/applications/ponder/phid/PonderPHIDTypeAnswer.php
@@ -16,15 +16,12 @@
return new PonderAnswer();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PonderAnswerQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/ponder/phid/PonderPHIDTypeQuestion.php b/src/applications/ponder/phid/PonderPHIDTypeQuestion.php
--- a/src/applications/ponder/phid/PonderPHIDTypeQuestion.php
+++ b/src/applications/ponder/phid/PonderPHIDTypeQuestion.php
@@ -16,15 +16,12 @@
return new PonderQuestion();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PonderQuestionQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/ponder/query/PonderAnswerQuery.php b/src/applications/ponder/query/PonderAnswerQuery.php
--- a/src/applications/ponder/query/PonderAnswerQuery.php
+++ b/src/applications/ponder/query/PonderAnswerQuery.php
@@ -123,4 +123,9 @@
return true;
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPonder';
+ }
+
}
diff --git a/src/applications/ponder/query/PonderQuestionQuery.php b/src/applications/ponder/query/PonderQuestionQuery.php
--- a/src/applications/ponder/query/PonderQuestionQuery.php
+++ b/src/applications/ponder/query/PonderQuestionQuery.php
@@ -194,4 +194,9 @@
return implode(' ', $joins);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationPonder';
+ }
+
}
diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
--- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
+++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
@@ -16,15 +16,12 @@
return new PhabricatorProject();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorProjectQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -260,4 +260,9 @@
return implode(' ', $joins);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationProject';
+ }
+
}
diff --git a/src/applications/releeph/phid/ReleephPHIDTypeBranch.php b/src/applications/releeph/phid/ReleephPHIDTypeBranch.php
--- a/src/applications/releeph/phid/ReleephPHIDTypeBranch.php
+++ b/src/applications/releeph/phid/ReleephPHIDTypeBranch.php
@@ -16,15 +16,12 @@
return new ReleephBranch();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ReleephBranchQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/releeph/phid/ReleephPHIDTypeProject.php b/src/applications/releeph/phid/ReleephPHIDTypeProject.php
--- a/src/applications/releeph/phid/ReleephPHIDTypeProject.php
+++ b/src/applications/releeph/phid/ReleephPHIDTypeProject.php
@@ -16,15 +16,12 @@
return new ReleephProject();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ReleephProjectQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/releeph/phid/ReleephPHIDTypeRequest.php b/src/applications/releeph/phid/ReleephPHIDTypeRequest.php
--- a/src/applications/releeph/phid/ReleephPHIDTypeRequest.php
+++ b/src/applications/releeph/phid/ReleephPHIDTypeRequest.php
@@ -16,15 +16,12 @@
return new ReleephRequest();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ReleephRequestQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/releeph/query/ReleephBranchQuery.php b/src/applications/releeph/query/ReleephBranchQuery.php
--- a/src/applications/releeph/query/ReleephBranchQuery.php
+++ b/src/applications/releeph/query/ReleephBranchQuery.php
@@ -129,4 +129,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationReleeph';
+ }
+
}
diff --git a/src/applications/releeph/query/ReleephProjectQuery.php b/src/applications/releeph/query/ReleephProjectQuery.php
--- a/src/applications/releeph/query/ReleephProjectQuery.php
+++ b/src/applications/releeph/query/ReleephProjectQuery.php
@@ -127,4 +127,8 @@
}
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationReleeph';
+ }
+
}
diff --git a/src/applications/releeph/query/ReleephRequestQuery.php b/src/applications/releeph/query/ReleephRequestQuery.php
--- a/src/applications/releeph/query/ReleephRequestQuery.php
+++ b/src/applications/releeph/query/ReleephRequestQuery.php
@@ -232,4 +232,9 @@
}
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationReleeph';
+ }
+
}
diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php
--- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php
+++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php
@@ -20,15 +20,12 @@
return new PhabricatorRepositoryArcanistProject();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorRepositoryArcanistProjectQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php
--- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php
+++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php
@@ -16,15 +16,12 @@
return new PhabricatorRepositoryCommit();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new DiffusionCommitQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
--- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
+++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
@@ -17,15 +17,12 @@
return new PhabricatorRepository();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorRepositoryQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php b/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
@@ -81,4 +81,10 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ // TODO: Diffusion? Differential?
+ return null;
+ }
+
}
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -317,4 +317,9 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationDiffusion';
+ }
+
}
diff --git a/src/applications/search/query/PhabricatorNamedQueryQuery.php b/src/applications/search/query/PhabricatorNamedQueryQuery.php
--- a/src/applications/search/query/PhabricatorNamedQueryQuery.php
+++ b/src/applications/search/query/PhabricatorNamedQueryQuery.php
@@ -81,4 +81,10 @@
return $this->formatWhereClause($where);
}
+
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationSearch';
+ }
+
}
diff --git a/src/applications/search/query/PhabricatorSavedQueryQuery.php b/src/applications/search/query/PhabricatorSavedQueryQuery.php
--- a/src/applications/search/query/PhabricatorSavedQueryQuery.php
+++ b/src/applications/search/query/PhabricatorSavedQueryQuery.php
@@ -65,4 +65,10 @@
return $this->formatWhereClause($where);
}
+
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationSearch';
+ }
+
}
diff --git a/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php b/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php
--- a/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php
+++ b/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php
@@ -16,15 +16,12 @@
return new PhabricatorSlowvotePoll();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorSlowvoteQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php b/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
--- a/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
+++ b/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
@@ -168,4 +168,9 @@
return 'p.id';
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationSlowvote';
+ }
+
}
diff --git a/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php b/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php
--- a/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php
+++ b/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php
@@ -16,15 +16,12 @@
return new PhabricatorToken();
}
- public function loadObjects(
+ protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorTokenQuery())
- ->setViewer($query->getViewer())
- ->setParentQuery($query)
- ->withPHIDs($phids)
- ->execute();
+ ->withPHIDs($phids);
}
public function loadHandles(
diff --git a/src/applications/tokens/query/PhabricatorTokenGivenQuery.php b/src/applications/tokens/query/PhabricatorTokenGivenQuery.php
--- a/src/applications/tokens/query/PhabricatorTokenGivenQuery.php
+++ b/src/applications/tokens/query/PhabricatorTokenGivenQuery.php
@@ -89,4 +89,8 @@
return $results;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationTokens';
+ }
+
}
diff --git a/src/applications/tokens/query/PhabricatorTokenQuery.php b/src/applications/tokens/query/PhabricatorTokenQuery.php
--- a/src/applications/tokens/query/PhabricatorTokenQuery.php
+++ b/src/applications/tokens/query/PhabricatorTokenQuery.php
@@ -61,4 +61,9 @@
return $tokens;
}
+
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationTokens';
+ }
+
}
diff --git a/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php b/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php
--- a/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php
+++ b/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php
@@ -34,4 +34,8 @@
return $this->tokenCounts;
}
+ public function getQueryApplicationClass() {
+ return 'PhabricatorApplicationTokens';
+ }
+
}
diff --git a/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php b/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php
--- a/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php
+++ b/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php
@@ -20,6 +20,12 @@
return null;
}
+ protected function buildQueryForObjects(
+ PhabricatorObjectQuery $object_query,
+ array $phids) {
+ throw new Exception();
+ }
+
public function loadObjects(
PhabricatorObjectQuery $object_query,
array $phids) {
@@ -55,11 +61,17 @@
continue;
}
- $xactions = id(clone $query)
+ $xaction_query = id(clone $query)
->setViewer($object_query->getViewer())
->setParentQuery($object_query)
- ->withPHIDs($subtype_phids)
- ->execute();
+ ->withPHIDs($subtype_phids);
+
+ if (!$xaction_query->canViewerUseQueryApplication()) {
+ $object_query->addPolicyFilteredPHIDs(array_fuse($subtype_phids));
+ continue;
+ }
+
+ $xactions = $xaction_query->execute();
$results += mpull($xactions, null, 'getPHID');
}
diff --git a/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php b/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
--- a/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
+++ b/src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
@@ -59,4 +59,10 @@
return $this->formatWhereClause($where);
}
+ public function getQueryApplicationClass() {
+ // TODO: Figure out the app via the template?
+ return null;
+ }
+
+
}
diff --git a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
--- a/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
+++ b/src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
@@ -160,4 +160,10 @@
return $this->formatWhereClause($where);
}
+
+ public function getQueryApplicationClass() {
+ // TODO: Sort this out?
+ return null;
+ }
+
}
diff --git a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
@@ -35,6 +35,7 @@
private $capabilities;
private $workspace = array();
private $policyFilteredPHIDs = array();
+ private $canUseApplication;
/* -( Query Configuration )------------------------------------------------ */
@@ -213,9 +214,13 @@
$this->rawResultLimit = 0;
}
- try {
- $page = $this->loadPage();
- } catch (PhabricatorEmptyQueryException $ex) {
+ if ($this->canViewerUseQueryApplication()) {
+ try {
+ $page = $this->loadPage();
+ } catch (PhabricatorEmptyQueryException $ex) {
+ $page = array();
+ }
+ } else {
$page = array();
}
@@ -317,7 +322,7 @@
PhabricatorPolicyCapability::CAN_VIEW);
}
- protected function addPolicyFilteredPHIDs(array $phids) {
+ public function addPolicyFilteredPHIDs(array $phids) {
$this->policyFilteredPHIDs += $phids;
if ($this->getParentQuery()) {
$this->getParentQuery()->addPolicyFilteredPHIDs($phids);
@@ -581,4 +586,43 @@
return false;
}
+
+ /**
+ * If this query belongs to an application, return the application class name
+ * here. This will prevent the query from returning results if the viewer can
+ * not access the application.
+ *
+ * If this query does not belong to an application, return `null`.
+ *
+ * @return string|null Application class name.
+ */
+ abstract public function getQueryApplicationClass();
+
+
+ /**
+ * Determine if the viewer has permission to use this query's application.
+ * For queries which aren't part of an application, this method always returns
+ * true.
+ *
+ * @return bool True if the viewer has application-level permission to
+ * execute the query.
+ */
+ public function canViewerUseQueryApplication() {
+ if ($this->canUseApplication === null) {
+ $class = $this->getQueryApplicationClass();
+ if (!$class) {
+ $this->canUseApplication = true;
+ } else {
+ $result = id(new PhabricatorApplicationQuery())
+ ->setViewer($this->getViewer())
+ ->withClasses(array($class))
+ ->execute();
+
+ $this->canUseApplication = (bool)$result;
+ }
+ }
+
+ return $this->canUseApplication;
+ }
+
}

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/rr/4o/pqai44e35vsfkncz
Default Alt Text
D7367.diff (56 KB)

Event Timeline