Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2680639
D25850.1734598497.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
4 KB
Referenced Files
None
Subscribers
None
D25850.1734598497.diff
View Options
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
@@ -4262,6 +4262,8 @@
'PhabricatorPhurlURLAliasTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php',
'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php',
'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php',
+ 'PhabricatorPhurlURLDefaultEditCapability' => 'applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php',
+ 'PhabricatorPhurlURLDefaultViewCapability' => 'applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php',
'PhabricatorPhurlURLDescriptionTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLDescriptionTransaction.php',
'PhabricatorPhurlURLEditConduitAPIMethod' => 'applications/phurl/conduit/PhabricatorPhurlURLEditConduitAPIMethod.php',
'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php',
@@ -10866,6 +10868,8 @@
'PhabricatorPhurlURLAliasTransaction' => 'PhabricatorPhurlURLTransactionType',
'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability',
'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource',
+ 'PhabricatorPhurlURLDefaultEditCapability' => 'PhabricatorPolicyCapability',
+ 'PhabricatorPhurlURLDefaultViewCapability' => 'PhabricatorPolicyCapability',
'PhabricatorPhurlURLDescriptionTransaction' => 'PhabricatorPhurlURLTransactionType',
'PhabricatorPhurlURLEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
diff --git a/src/applications/phurl/application/PhabricatorPhurlApplication.php b/src/applications/phurl/application/PhabricatorPhurlApplication.php
--- a/src/applications/phurl/application/PhabricatorPhurlApplication.php
+++ b/src/applications/phurl/application/PhabricatorPhurlApplication.php
@@ -73,6 +73,15 @@
PhabricatorPhurlURLCreateCapability::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_USER,
),
+ PhabricatorPhurlURLDefaultViewCapability::CAPABILITY => array(
+ 'template' => PhabricatorPhurlURLPHIDType::TYPECONST,
+ 'capability' => PhabricatorPolicyCapability::CAN_VIEW,
+ ),
+ PhabricatorPhurlURLDefaultEditCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_USER,
+ 'template' => PhabricatorPhurlURLPHIDType::TYPECONST,
+ 'capability' => PhabricatorPolicyCapability::CAN_EDIT,
+ ),
);
}
diff --git a/src/applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php b/src/applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php
@@ -0,0 +1,12 @@
+<?php
+
+final class PhabricatorPhurlURLDefaultEditCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'phurl.url.default.edit';
+
+ public function getCapabilityName() {
+ return pht('Default Edit Policy');
+ }
+
+}
diff --git a/src/applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php b/src/applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorPhurlURLDefaultViewCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'phurl.url.default.view';
+
+ public function getCapabilityName() {
+ return pht('Default View Policy');
+ }
+
+ public function shouldAllowPublicPolicySetting() {
+ return true;
+ }
+
+}
diff --git a/src/applications/phurl/storage/PhabricatorPhurlURL.php b/src/applications/phurl/storage/PhabricatorPhurlURL.php
--- a/src/applications/phurl/storage/PhabricatorPhurlURL.php
+++ b/src/applications/phurl/storage/PhabricatorPhurlURL.php
@@ -34,10 +34,15 @@
->withClasses(array('PhabricatorPhurlApplication'))
->executeOne();
+ $view_policy = $app->getPolicy(
+ PhabricatorPhurlURLDefaultViewCapability::CAPABILITY);
+ $edit_policy = $app->getPolicy(
+ PhabricatorPhurlURLDefaultEditCapability::CAPABILITY);
+
return id(new PhabricatorPhurlURL())
->setAuthorPHID($actor->getPHID())
- ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy())
- ->setEditPolicy($actor->getPHID())
+ ->setViewPolicy($view_policy)
+ ->setEditPolicy($edit_policy)
->setSpacePHID($actor->getDefaultSpacePHID());
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 08:54 (19 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015029
Default Alt Text
D25850.1734598497.diff (4 KB)
Attached To
Mode
D25850: Allow customizing default Phurl view and edit policies
Attached
Detach File
Event Timeline
Log In to Comment