1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Policy - filter app engines where the user can't see the application from panel editing

Summary: Fixes T7118. This does the basic "filter the list" thing, though it ends up being a little manual since I guess this hasn't come up before? There is also potential weird behavior if the user was using an app and lost access to it - they will have nothing selected on edit - but I think this is actually correct behavior in this circumstance.

Test Plan:
used a user who couldn't get access to the "quick create" apps and noted that the dropdown list on dashboard panel create was missing the expected engines

ran `arc unit --everything` to verify abstract method implemented everywhere

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7118

Differential Revision: https://secure.phabricator.com/D11687
This commit is contained in:
Bob Trahan 2015-02-04 15:47:48 -08:00
parent 1272abbfd9
commit 5a9df1a225
54 changed files with 97 additions and 44 deletions

View file

@ -7,7 +7,7 @@ final class AlmanacDeviceSearchEngine
return pht('Almanac Devices'); return pht('Almanac Devices');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorAlmanacApplication'; return 'PhabricatorAlmanacApplication';
} }

View file

@ -7,7 +7,7 @@ final class AlmanacNetworkSearchEngine
return pht('Almanac Networks'); return pht('Almanac Networks');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorAlmanacApplication'; return 'PhabricatorAlmanacApplication';
} }

View file

@ -7,7 +7,7 @@ final class AlmanacServiceSearchEngine
return pht('Almanac Services'); return pht('Almanac Services');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorAlmanacApplication'; return 'PhabricatorAlmanacApplication';
} }

View file

@ -7,6 +7,10 @@ final class PhabricatorCommitSearchEngine
return pht('Commits'); return pht('Commits');
} }
public function getApplicationClassName() {
return 'PhabricatorDiffusionApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -7,7 +7,7 @@ final class PhabricatorCalendarEventSearchEngine
return pht('Calendar Events'); return pht('Calendar Events');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorCalendarApplication'; return 'PhabricatorCalendarApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorConduitSearchEngine
return pht('Conduit Methods'); return pht('Conduit Methods');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorConduitApplication'; return 'PhabricatorConduitApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorCountdownSearchEngine
return pht('Countdowns'); return pht('Countdowns');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorCountdownApplication'; return 'PhabricatorCountdownApplication';
} }

View file

@ -16,6 +16,17 @@ final class PhabricatorDashboardPanelSearchApplicationCustomField
$engines = id(new PhutilSymbolLoader()) $engines = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorApplicationSearchEngine') ->setAncestorClass('PhabricatorApplicationSearchEngine')
->loadObjects(); ->loadObjects();
$all_apps = id(new PhabricatorApplicationQuery())
->setViewer($this->getViewer())
->withUnlisted(false)
->withInstalled(true)
->execute();
foreach ($engines as $index => $engine) {
if (!isset($all_apps[$engine->getApplicationClassName()])) {
unset($engines[$index]);
continue;
}
}
$options = array(); $options = array();

View file

@ -7,7 +7,7 @@ final class PhabricatorDashboardPanelSearchEngine
return pht('Dashboard Panels'); return pht('Dashboard Panels');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDashboardApplication'; return 'PhabricatorDashboardApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorDashboardSearchEngine
return pht('Dashboards'); return pht('Dashboards');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDashboardApplication'; return 'PhabricatorDashboardApplication';
} }

View file

@ -7,7 +7,7 @@ final class DifferentialRevisionSearchEngine
return pht('Differential Revisions'); return pht('Differential Revisions');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDifferentialApplication'; return 'PhabricatorDifferentialApplication';
} }

View file

@ -6,7 +6,7 @@ final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine {
return pht('Documentation Atoms'); return pht('Documentation Atoms');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDivinerApplication'; return 'PhabricatorDivinerApplication';
} }

View file

@ -7,7 +7,7 @@ final class DrydockBlueprintSearchEngine
return pht('Drydock Blueprints'); return pht('Drydock Blueprints');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDrydockApplication'; return 'PhabricatorDrydockApplication';
} }

View file

@ -7,7 +7,7 @@ final class DrydockLeaseSearchEngine
return pht('Drydock Leases'); return pht('Drydock Leases');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDrydockApplication'; return 'PhabricatorDrydockApplication';
} }

View file

@ -6,7 +6,7 @@ final class DrydockLogSearchEngine extends PhabricatorApplicationSearchEngine {
return pht('Drydock Logs'); return pht('Drydock Logs');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDrydockApplication'; return 'PhabricatorDrydockApplication';
} }

View file

@ -7,7 +7,7 @@ final class DrydockResourceSearchEngine
return pht('Drydock Resources'); return pht('Drydock Resources');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDrydockApplication'; return 'PhabricatorDrydockApplication';
} }

View file

@ -7,6 +7,10 @@ final class PhabricatorFeedSearchEngine
return pht('Feed Stories'); return pht('Feed Stories');
} }
public function getApplicationClassName() {
return 'PhabricatorFeedApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -7,7 +7,7 @@ final class PhabricatorFileSearchEngine
return pht('Files'); return pht('Files');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorFilesApplication'; return 'PhabricatorFilesApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorFlagSearchEngine
return pht('Flags'); return pht('Flags');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorFlagsApplication'; return 'PhabricatorFlagsApplication';
} }

View file

@ -18,7 +18,7 @@ final class FundBackerSearchEngine
return pht('Fund Backers'); return pht('Fund Backers');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorFundApplication'; return 'PhabricatorFundApplication';
} }

View file

@ -7,7 +7,7 @@ final class FundInitiativeSearchEngine
return pht('Fund Initiatives'); return pht('Fund Initiatives');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorFundApplication'; return 'PhabricatorFundApplication';
} }

View file

@ -7,7 +7,7 @@ final class HarbormasterBuildPlanSearchEngine
return pht('Harbormaster Build Plans'); return pht('Harbormaster Build Plans');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorHarbormasterApplication'; return 'PhabricatorHarbormasterApplication';
} }

View file

@ -7,7 +7,7 @@ final class HarbormasterBuildableSearchEngine
return pht('Harbormaster Buildables'); return pht('Harbormaster Buildables');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorHarbormasterApplication'; return 'PhabricatorHarbormasterApplication';
} }

View file

@ -6,7 +6,7 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine {
return pht('Herald Rules'); return pht('Herald Rules');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorHeraldApplication'; return 'PhabricatorHeraldApplication';
} }

View file

@ -7,7 +7,7 @@ final class HeraldTranscriptSearchEngine
return pht('Herald Transcripts'); return pht('Herald Transcripts');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorHeraldApplication'; return 'PhabricatorHeraldApplication';
} }

View file

@ -7,7 +7,7 @@ final class LegalpadDocumentSearchEngine
return pht('Legalpad Documents'); return pht('Legalpad Documents');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorLegalpadApplication'; return 'PhabricatorLegalpadApplication';
} }

View file

@ -9,7 +9,7 @@ final class LegalpadDocumentSignatureSearchEngine
return pht('Legalpad Signatures'); return pht('Legalpad Signatures');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorLegalpadApplication'; return 'PhabricatorLegalpadApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorMacroSearchEngine
return pht('Macros'); return pht('Macros');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorMacroApplication'; return 'PhabricatorMacroApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorMailingListSearchEngine
return pht('Mailing Lists'); return pht('Mailing Lists');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorMailingListsApplication'; return 'PhabricatorMailingListsApplication';
} }

View file

@ -34,7 +34,7 @@ final class ManiphestTaskSearchEngine
return pht('Tasks'); return pht('Tasks');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorManiphestApplication'; return 'PhabricatorManiphestApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorAppSearchEngine
return pht('Applications'); return pht('Applications');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorApplicationsApplication'; return 'PhabricatorApplicationsApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorNotificationSearchEngine
return pht('Notifications'); return pht('Notifications');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorNotificationsApplication'; return 'PhabricatorNotificationsApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorOAuthServerClientSearchEngine
return pht('OAuth Clients'); return pht('OAuth Clients');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorOAuthServerApplication'; return 'PhabricatorOAuthServerApplication';
} }

View file

@ -7,7 +7,7 @@ final class PassphraseCredentialSearchEngine
return pht('Passphrase Credentials'); return pht('Passphrase Credentials');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPassphraseApplication'; return 'PhabricatorPassphraseApplication';
} }

View file

@ -7,6 +7,10 @@ final class PhabricatorPasteSearchEngine
return pht('Pastes'); return pht('Pastes');
} }
public function getApplicationClassName() {
return 'PhabricatorPasteApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();
$saved->setParameter( $saved->setParameter(

View file

@ -7,7 +7,7 @@ final class PhabricatorPeopleLogSearchEngine
return pht('Account Activity'); return pht('Account Activity');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPeopleApplication'; return 'PhabricatorPeopleApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorPeopleSearchEngine
return pht('Users'); return pht('Users');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPeopleApplication'; return 'PhabricatorPeopleApplication';
} }

View file

@ -6,7 +6,7 @@ final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine {
return pht('Pholio Mocks'); return pht('Pholio Mocks');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPholioApplication'; return 'PhabricatorPholioApplication';
} }

View file

@ -38,6 +38,10 @@ final class PhortuneCartSearchEngine
return pht('Phortune Orders'); return pht('Phortune Orders');
} }
public function getApplicationClassName() {
return 'PhabricatorPhortuneApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -18,6 +18,10 @@ final class PhortuneChargeSearchEngine
return pht('Phortune Charges'); return pht('Phortune Charges');
} }
public function getApplicationClassName() {
return 'PhabricatorPhortuneApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -7,6 +7,10 @@ final class PhortuneMerchantSearchEngine
return pht('Phortune Merchants'); return pht('Phortune Merchants');
} }
public function getApplicationClassName() {
return 'PhabricatorPhortuneApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -28,6 +28,10 @@ final class PhortuneSubscriptionSearchEngine
return pht('Phortune Subscriptions'); return pht('Phortune Subscriptions');
} }
public function getApplicationClassName() {
return 'PhabricatorPhortuneApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -6,7 +6,7 @@ final class PhrequentSearchEngine extends PhabricatorApplicationSearchEngine {
return pht('Phrequent Time'); return pht('Phrequent Time');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPhrequentApplication'; return 'PhabricatorPhrequentApplication';
} }

View file

@ -7,6 +7,10 @@ final class PhrictionSearchEngine
return pht('Wiki Documents'); return pht('Wiki Documents');
} }
public function getApplicationClassName() {
return 'PhabricatorPhrictionApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();

View file

@ -7,7 +7,7 @@ final class PonderQuestionSearchEngine
return pht('Ponder Questions'); return pht('Ponder Questions');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorPonderApplication'; return 'PhabricatorPonderApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorProjectSearchEngine
return pht('Projects'); return pht('Projects');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorProjectApplication'; return 'PhabricatorProjectApplication';
} }

View file

@ -9,6 +9,10 @@ final class ReleephBranchSearchEngine
return pht('Releeph Branches'); return pht('Releeph Branches');
} }
public function getApplicationClassName() {
return 'PhabricatorReleephApplication';
}
public function setProduct(ReleephProject $product) { public function setProduct(ReleephProject $product) {
$this->product = $product; $this->product = $product;
return $this; return $this;

View file

@ -7,7 +7,7 @@ final class ReleephProductSearchEngine
return pht('Releeph Products'); return pht('Releeph Products');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorReleephApplication'; return 'PhabricatorReleephApplication';
} }

View file

@ -10,6 +10,10 @@ final class ReleephRequestSearchEngine
return pht('Releeph Pull Requests'); return pht('Releeph Pull Requests');
} }
public function getApplicationClassName() {
return 'PhabricatorReleephApplication';
}
public function setBranch(ReleephBranch $branch) { public function setBranch(ReleephBranch $branch) {
$this->branch = $branch; $this->branch = $branch;
return $this; return $this;

View file

@ -7,7 +7,7 @@ final class PhabricatorRepositoryPushLogSearchEngine
return pht('Push Logs'); return pht('Push Logs');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDiffusionApplication'; return 'PhabricatorDiffusionApplication';
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorRepositorySearchEngine
return pht('Repositories'); return pht('Repositories');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorDiffusionApplication'; return 'PhabricatorDiffusionApplication';
} }

View file

@ -243,9 +243,7 @@ abstract class PhabricatorApplicationSearchEngine {
return $this->application; return $this->application;
} }
protected function getApplicationClassName() { abstract public function getApplicationClassName();
throw new PhutilMethodNotImplementedException();
}
/* -( Constructing Engines )----------------------------------------------- */ /* -( Constructing Engines )----------------------------------------------- */

View file

@ -7,7 +7,7 @@ final class PhabricatorSearchApplicationSearchEngine
return pht('Fulltext Results'); return pht('Fulltext Results');
} }
protected function getApplicationClassName() { public function getApplicationClassName() {
return 'PhabricatorSearchApplication'; return 'PhabricatorSearchApplication';
} }

View file

@ -7,6 +7,10 @@ final class PhabricatorSlowvoteSearchEngine
return pht('Slowvotes'); return pht('Slowvotes');
} }
public function getApplicationClassName() {
return 'PhabricatorSlowvoteApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) { public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery(); $saved = new PhabricatorSavedQuery();
$saved->setParameter( $saved->setParameter(