diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3169314815..e1b649ce36 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4262,6 +4262,8 @@ phutil_register_library_map(array( '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 @@ phutil_register_library_map(array( '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 index 56290ef5e1..e7ffa0e744 100644 --- a/src/applications/phurl/application/PhabricatorPhurlApplication.php +++ b/src/applications/phurl/application/PhabricatorPhurlApplication.php @@ -73,6 +73,15 @@ final class PhabricatorPhurlApplication extends PhabricatorApplication { 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 index 0000000000..86ed740466 --- /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()); }