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::POLICY_ADMIN, + ), ); } 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 @@ +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()); }