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');
}
protected function getApplicationClassName() {
public function getApplicationClassName() {
return 'PhabricatorAlmanacApplication';
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,6 +16,17 @@ final class PhabricatorDashboardPanelSearchApplicationCustomField
$engines = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorApplicationSearchEngine')
->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();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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