@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow customizing default Phurl view and edit policies

Summary:
| Before | After |
|----------|----------|
|{F2669862}|{F2669861}|

Closes T15970

Test Plan:
* Go to http://phorge.localhost/applications/view/PhabricatorPhurlApplication/ and see two additional settings "Default View Policy" and "Default Edit Policy"
* Go to http://phorge.localhost/applications/view/PhabricatorPhurlApplication/ and select "Edit Policies" to see and set two additional settings
* Go to http://phorge.localhost/phurl/url/edit/form/default/ and check the "Visible To" and "Editable By" fields now showing the default page
* Check existing Phurls which did not have their policies changed as that's stored in the database
* run `arc liberate` again and see that it's already updated

Reviewers: O1 Blessed Committers, aklapper, valerio.bozzolan

Reviewed By: O1 Blessed Committers, aklapper, valerio.bozzolan

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15970

Differential Revision: https://we.phorge.it/D25850

+48 -2
+4
src/__phutil_library_map__.php
··· 4262 4262 'PhabricatorPhurlURLAliasTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLAliasTransaction.php', 4263 4263 'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php', 4264 4264 'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php', 4265 + 'PhabricatorPhurlURLDefaultEditCapability' => 'applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php', 4266 + 'PhabricatorPhurlURLDefaultViewCapability' => 'applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php', 4265 4267 'PhabricatorPhurlURLDescriptionTransaction' => 'applications/phurl/xaction/PhabricatorPhurlURLDescriptionTransaction.php', 4266 4268 'PhabricatorPhurlURLEditConduitAPIMethod' => 'applications/phurl/conduit/PhabricatorPhurlURLEditConduitAPIMethod.php', 4267 4269 'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php', ··· 10866 10868 'PhabricatorPhurlURLAliasTransaction' => 'PhabricatorPhurlURLTransactionType', 10867 10869 'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability', 10868 10870 'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource', 10871 + 'PhabricatorPhurlURLDefaultEditCapability' => 'PhabricatorPolicyCapability', 10872 + 'PhabricatorPhurlURLDefaultViewCapability' => 'PhabricatorPolicyCapability', 10869 10873 'PhabricatorPhurlURLDescriptionTransaction' => 'PhabricatorPhurlURLTransactionType', 10870 10874 'PhabricatorPhurlURLEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 10871 10875 'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
+9
src/applications/phurl/application/PhabricatorPhurlApplication.php
··· 73 73 PhabricatorPhurlURLCreateCapability::CAPABILITY => array( 74 74 'default' => PhabricatorPolicies::POLICY_USER, 75 75 ), 76 + PhabricatorPhurlURLDefaultViewCapability::CAPABILITY => array( 77 + 'template' => PhabricatorPhurlURLPHIDType::TYPECONST, 78 + 'capability' => PhabricatorPolicyCapability::CAN_VIEW, 79 + ), 80 + PhabricatorPhurlURLDefaultEditCapability::CAPABILITY => array( 81 + 'default' => PhabricatorPolicies::POLICY_USER, 82 + 'template' => PhabricatorPhurlURLPHIDType::TYPECONST, 83 + 'capability' => PhabricatorPolicyCapability::CAN_EDIT, 84 + ), 76 85 ); 77 86 } 78 87
+12
src/applications/phurl/capability/PhabricatorPhurlURLDefaultEditCapability.php
··· 1 + <?php 2 + 3 + final class PhabricatorPhurlURLDefaultEditCapability 4 + extends PhabricatorPolicyCapability { 5 + 6 + const CAPABILITY = 'phurl.url.default.edit'; 7 + 8 + public function getCapabilityName() { 9 + return pht('Default Edit Policy'); 10 + } 11 + 12 + }
+16
src/applications/phurl/capability/PhabricatorPhurlURLDefaultViewCapability.php
··· 1 + <?php 2 + 3 + final class PhabricatorPhurlURLDefaultViewCapability 4 + extends PhabricatorPolicyCapability { 5 + 6 + const CAPABILITY = 'phurl.url.default.view'; 7 + 8 + public function getCapabilityName() { 9 + return pht('Default View Policy'); 10 + } 11 + 12 + public function shouldAllowPublicPolicySetting() { 13 + return true; 14 + } 15 + 16 + }
+7 -2
src/applications/phurl/storage/PhabricatorPhurlURL.php
··· 34 34 ->withClasses(array('PhabricatorPhurlApplication')) 35 35 ->executeOne(); 36 36 37 + $view_policy = $app->getPolicy( 38 + PhabricatorPhurlURLDefaultViewCapability::CAPABILITY); 39 + $edit_policy = $app->getPolicy( 40 + PhabricatorPhurlURLDefaultEditCapability::CAPABILITY); 41 + 37 42 return id(new PhabricatorPhurlURL()) 38 43 ->setAuthorPHID($actor->getPHID()) 39 - ->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy()) 40 - ->setEditPolicy($actor->getPHID()) 44 + ->setViewPolicy($view_policy) 45 + ->setEditPolicy($edit_policy) 41 46 ->setSpacePHID($actor->getDefaultSpacePHID()); 42 47 } 43 48