Page MenuHomePhorge

D25101.1737255994.diff
No OneTemporary

D25101.1737255994.diff

diff --git a/src/applications/countdown/application/PhabricatorCountdownApplication.php b/src/applications/countdown/application/PhabricatorCountdownApplication.php
--- a/src/applications/countdown/application/PhabricatorCountdownApplication.php
+++ b/src/applications/countdown/application/PhabricatorCountdownApplication.php
@@ -50,6 +50,10 @@
protected function getCustomCapabilities() {
return array(
+ PhabricatorCountdownCreateCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_USER,
+ 'caption' => pht('Default create policy for countdowns.'),
+ ),
PhabricatorCountdownDefaultViewCapability::CAPABILITY => array(
'caption' => pht('Default view policy for new countdowns.'),
'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST,
diff --git a/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php b/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorCountdownCreateCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'countdown.create';
+
+ public function getCapabilityName() {
+ return pht('Can Create Countdowns');
+ }
+
+ public function describeCapabilityRejection() {
+ return pht('You do not have permission to create a countdown.');
+ }
+
+}
diff --git a/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php b/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
--- a/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
+++ b/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
@@ -70,6 +70,11 @@
return $object->getURI();
}
+ protected function getCreateNewObjectPolicy() {
+ return $this->getApplication()->getPolicy(
+ PhabricatorCountdownCreateCapability::CAPABILITY);
+ }
+
protected function buildCustomEditFields($object) {
$epoch_value = $object->getEpoch();
if ($epoch_value === null) {

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 03:06 (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1108688
Default Alt Text
D25101.1737255994.diff (2 KB)

Event Timeline