Page MenuHomePhorge

D25270.1734737780.diff
No OneTemporary

D25270.1734737780.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3081,6 +3081,7 @@
'PhabricatorDashboardColumn' => 'applications/dashboard/layoutconfig/PhabricatorDashboardColumn.php',
'PhabricatorDashboardConsoleController' => 'applications/dashboard/controller/PhabricatorDashboardConsoleController.php',
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
+ 'PhabricatorDashboardCreateCapability' => 'applications/countdown/capability/PhabricatorDashboardCreateCapability.php',
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php',
'PhabricatorDashboardDatasource' => 'applications/dashboard/typeahead/PhabricatorDashboardDatasource.php',
@@ -9496,6 +9497,7 @@
'PhabricatorDashboardColumn' => 'Phobject',
'PhabricatorDashboardConsoleController' => 'PhabricatorDashboardController',
'PhabricatorDashboardController' => 'PhabricatorController',
+ 'PhabricatorDashboardCreateCapability' => 'PhabricatorPolicyCapability',
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType',
'PhabricatorDashboardDatasource' => 'PhabricatorTypeaheadDatasource',
diff --git a/src/applications/countdown/capability/PhabricatorDashboardCreateCapability.php b/src/applications/countdown/capability/PhabricatorDashboardCreateCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/countdown/capability/PhabricatorDashboardCreateCapability.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorDashboardCreateCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'dashboard.create';
+
+ public function getCapabilityName() {
+ return pht('Can Create Dashboards');
+ }
+
+ public function describeCapabilityRejection() {
+ return pht('You do not have permission to create a dashboard.');
+ }
+
+}
diff --git a/src/applications/dashboard/application/PhabricatorDashboardApplication.php b/src/applications/dashboard/application/PhabricatorDashboardApplication.php
--- a/src/applications/dashboard/application/PhabricatorDashboardApplication.php
+++ b/src/applications/dashboard/application/PhabricatorDashboardApplication.php
@@ -83,4 +83,12 @@
);
}
+ protected function getCustomCapabilities() {
+ return array(
+ PhabricatorDashboardCreateCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_USER,
+ 'caption' => pht('Default create policy for Dashboards.'),
+ ),
+ );
+ }
}
diff --git a/src/applications/dashboard/editor/PhabricatorDashboardEditEngine.php b/src/applications/dashboard/editor/PhabricatorDashboardEditEngine.php
--- a/src/applications/dashboard/editor/PhabricatorDashboardEditEngine.php
+++ b/src/applications/dashboard/editor/PhabricatorDashboardEditEngine.php
@@ -66,6 +66,11 @@
return $object->getURI();
}
+ protected function getCreateNewObjectPolicy() {
+ return $this->getApplication()->getPolicy(
+ PhabricatorDashboardCreateCapability::CAPABILITY);
+ }
+
protected function buildCustomEditFields($object) {
$layout_options = PhabricatorDashboardLayoutMode::getLayoutModeMap();

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 23:36 (17 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016682
Default Alt Text
D25270.1734737780.diff (3 KB)

Event Timeline