Page MenuHomePhabricator

D13963.id.diff
No OneTemporary

D13963.id.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
@@ -178,6 +178,7 @@
'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php',
'CalendarTimeUtil' => 'applications/calendar/util/CalendarTimeUtil.php',
'CalendarTimeUtilTestCase' => 'applications/calendar/__tests__/CalendarTimeUtilTestCase.php',
+ 'CalendarDefaultEditCapability' => 'applications/calendar/capability/CalendarDefaultEditCapability.php',
'CelerityAPI' => 'applications/celerity/CelerityAPI.php',
'CelerityDefaultPostprocessor' => 'applications/celerity/postprocessor/CelerityDefaultPostprocessor.php',
'CelerityHighContrastPostprocessor' => 'applications/celerity/postprocessor/CelerityHighContrastPostprocessor.php',
@@ -3680,6 +3681,7 @@
'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability',
'CalendarTimeUtil' => 'Phobject',
'CalendarTimeUtilTestCase' => 'PhabricatorTestCase',
+ 'CalendarDefaultEditCapability' => 'PhabricatorPolicyCapability',
'CelerityAPI' => 'Phobject',
'CelerityDefaultPostprocessor' => 'CelerityPostprocessor',
'CelerityHighContrastPostprocessor' => 'CelerityPostprocessor',
diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php
--- a/src/applications/calendar/application/PhabricatorCalendarApplication.php
+++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php
@@ -80,6 +80,14 @@
return $items;
}
+ protected function getCustomCapabilities() {
+ return array(
+ CalendarDefaultEditCapability::CAPABILITY => array(
+ 'caption' => pht('Default edit policy for newly created events.')
+ )
+ );
+ }
+
public function getMailCommandObjects() {
return array(
'event' => array(
diff --git a/src/applications/calendar/capability/CalendarDefaultEditCapability.php b/src/applications/calendar/capability/CalendarDefaultEditCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/calendar/capability/CalendarDefaultEditCapability.php
@@ -0,0 +1,11 @@
+<?php
+
+final class CalendarDefaultEditCapability extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'calendar.default.edit';
+
+ public function getCapabilityName() {
+ return pht('Default Edit Policy');
+ }
+
+}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -66,6 +66,8 @@
$is_recurring = true;
}
+ $edit_policy = $app->getPolicy(CalendarDefaultEditCapability::CAPABILITY);
+
return id(new PhabricatorCalendarEvent())
->setUserPHID($actor->getPHID())
->setIsCancelled(0)
@@ -73,7 +75,7 @@
->setIsRecurring($is_recurring)
->setIcon(self::DEFAULT_ICON)
->setViewPolicy($view_policy)
- ->setEditPolicy($actor->getPHID())
+ ->setEditPolicy($edit_policy)
->setSpacePHID($actor->getDefaultSpacePHID())
->attachInvitees(array())
->applyViewerTimezone($actor);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 7:39 AM (15 h, 32 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6754481
Default Alt Text
D13963.id.diff (3 KB)

Event Timeline