Page MenuHomePhabricator

D7415.id16704.diff
No OneTemporary

D7415.id16704.diff

Index: resources/sql/patches/20131025.repopush.sql
===================================================================
--- /dev/null
+++ resources/sql/patches/20131025.repopush.sql
@@ -0,0 +1,5 @@
+ALTER TABLE {$NAMESPACE}_repository.repository
+ ADD COLUMN pushPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin;
+
+UPDATE {$NAMESPACE}_repository.repository
+ SET pushPolicy = 'users' WHERE pushPolicy = '';
Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -451,7 +451,9 @@
'DiffusionBrowseTableView' => 'applications/diffusion/view/DiffusionBrowseTableView.php',
'DiffusionCapabilityCreateRepositories' => 'applications/diffusion/capability/DiffusionCapabilityCreateRepositories.php',
'DiffusionCapabilityDefaultEdit' => 'applications/diffusion/capability/DiffusionCapabilityDefaultEdit.php',
+ 'DiffusionCapabilityDefaultPush' => 'applications/diffusion/capability/DiffusionCapabilityDefaultPush.php',
'DiffusionCapabilityDefaultView' => 'applications/diffusion/capability/DiffusionCapabilityDefaultView.php',
+ 'DiffusionCapabilityPush' => 'applications/diffusion/capability/DiffusionCapabilityPush.php',
'DiffusionChangeController' => 'applications/diffusion/controller/DiffusionChangeController.php',
'DiffusionCommentListView' => 'applications/diffusion/view/DiffusionCommentListView.php',
'DiffusionCommentView' => 'applications/diffusion/view/DiffusionCommentView.php',
@@ -1631,7 +1633,6 @@
'PhabricatorRepositoryCommitSearchIndexer' => 'applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php',
'PhabricatorRepositoryConfigOptions' => 'applications/repository/PhabricatorRepositoryConfigOptions.php',
'PhabricatorRepositoryController' => 'applications/repository/controller/PhabricatorRepositoryController.php',
- 'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php',
'PhabricatorRepositoryEditor' => 'applications/repository/editor/PhabricatorRepositoryEditor.php',
@@ -2638,7 +2639,9 @@
'DiffusionBrowseTableView' => 'DiffusionView',
'DiffusionCapabilityCreateRepositories' => 'PhabricatorPolicyCapability',
'DiffusionCapabilityDefaultEdit' => 'PhabricatorPolicyCapability',
+ 'DiffusionCapabilityDefaultPush' => 'PhabricatorPolicyCapability',
'DiffusionCapabilityDefaultView' => 'PhabricatorPolicyCapability',
+ 'DiffusionCapabilityPush' => 'PhabricatorPolicyCapability',
'DiffusionChangeController' => 'DiffusionController',
'DiffusionCommentListView' => 'AphrontView',
'DiffusionCommentView' => 'AphrontView',
@@ -3960,7 +3963,6 @@
'PhabricatorRepositoryCommitSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorRepositoryConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRepositoryController' => 'PhabricatorController',
- 'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
'PhabricatorRepositoryEditor' => 'PhabricatorApplicationTransactionEditor',
Index: src/applications/diffusion/capability/DiffusionCapabilityDefaultPush.php
===================================================================
--- /dev/null
+++ src/applications/diffusion/capability/DiffusionCapabilityDefaultPush.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionCapabilityDefaultPush
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'diffusion.default.push';
+
+ public function getCapabilityKey() {
+ return self::CAPABILITY;
+ }
+
+ public function getCapabilityName() {
+ return pht('Default Push Policy');
+ }
+
+}
Index: src/applications/diffusion/capability/DiffusionCapabilityPush.php
===================================================================
--- /dev/null
+++ src/applications/diffusion/capability/DiffusionCapabilityPush.php
@@ -0,0 +1,20 @@
+<?php
+
+final class DiffusionCapabilityPush
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'diffusion.push';
+
+ public function getCapabilityKey() {
+ return self::CAPABILITY;
+ }
+
+ public function getCapabilityName() {
+ return pht('Can Push');
+ }
+
+ public function describeCapabilityRejection() {
+ return pht('You do not have permission to push to this repository.');
+ }
+
+}
Index: src/applications/repository/storage/PhabricatorRepository.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepository.php
+++ src/applications/repository/storage/PhabricatorRepository.php
@@ -31,6 +31,7 @@
protected $uuid;
protected $viewPolicy;
protected $editPolicy;
+ protected $pushPolicy;
protected $versionControlSystem;
protected $details = array();
@@ -48,10 +49,12 @@
$view_policy = $app->getPolicy(DiffusionCapabilityDefaultView::CAPABILITY);
$edit_policy = $app->getPolicy(DiffusionCapabilityDefaultEdit::CAPABILITY);
+ $push_policy = $app->getPolicy(DiffusionCapabilityDefaultPush::CAPABILITY);
return id(new PhabricatorRepository())
->setViewPolicy($view_policy)
- ->setEditPolicy($edit_policy);
+ ->setEditPolicy($edit_policy)
+ ->setPushPolicy($push_policy);
}
public function getConfiguration() {
Index: src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
===================================================================
--- src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
+++ src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
@@ -1704,6 +1704,10 @@
'type' => 'sql',
'name' => $this->getPatchPath('20131020.harbormaster.sql'),
),
+ '20131025.repopush.sql' => array(
+ 'type' => 'sql',
+ 'name' => $this->getPatchPath('20131025.repopush.sql'),
+ ),
);
}
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 5:02 PM (2 d, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6718482
Default Alt Text
D7415.id16704.diff (6 KB)

Event Timeline