Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14035903
D7415.id16745.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D7415.id16745.diff
View Options
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',
'PhabricatorRepositoryEditController' => 'applications/repository/controller/PhabricatorRepositoryEditController.php',
@@ -2639,7 +2640,9 @@
'DiffusionBrowseTableView' => 'DiffusionView',
'DiffusionCapabilityCreateRepositories' => 'PhabricatorPolicyCapability',
'DiffusionCapabilityDefaultEdit' => 'PhabricatorPolicyCapability',
+ 'DiffusionCapabilityDefaultPush' => 'PhabricatorPolicyCapability',
'DiffusionCapabilityDefaultView' => 'PhabricatorPolicyCapability',
+ 'DiffusionCapabilityPush' => 'PhabricatorPolicyCapability',
'DiffusionChangeController' => 'DiffusionController',
'DiffusionCommentListView' => 'AphrontView',
'DiffusionCommentView' => 'AphrontView',
@@ -3961,7 +3964,6 @@
'PhabricatorRepositoryCommitSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PhabricatorRepositoryConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRepositoryController' => 'PhabricatorController',
- 'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
'PhabricatorRepositoryEditController' => 'PhabricatorRepositoryController',
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() {
@@ -713,6 +716,7 @@
return array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
+ DiffusionCapabilityPush::CAPABILITY,
);
}
@@ -722,6 +726,8 @@
return $this->getViewPolicy();
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->getEditPolicy();
+ case DiffusionCapabilityPush::CAPABILITY:
+ return $this->getPushPolicy();
}
}
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 7:59 AM (2 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6718463
Default Alt Text
D7415.id16745.diff (6 KB)
Attached To
Mode
D7415: Add global "push" policy to Repositories
Attached
Detach File
Event Timeline
Log In to Comment