diff --git a/resources/sql/patches/pastepolicy.sql b/resources/sql/patches/pastepolicy.sql new file mode 100644 index 0000000000..9cde1b53b4 --- /dev/null +++ b/resources/sql/patches/pastepolicy.sql @@ -0,0 +1,5 @@ +ALTER TABLE `{$NAMESPACE}_pastebin`.`pastebin_paste` + ADD `viewPolicy` varchar(64) COLLATE utf8_bin; + +UPDATE `{$NAMESPACE}_pastebin`.`pastebin_paste` SET viewPolicy = 'users' + WHERE viewPolicy IS NULL; diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 387f3c8837..2290b6b94d 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -25,6 +25,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO protected $filePHID; protected $language; protected $parentPHID; + protected $viewPolicy; private $content; @@ -52,7 +53,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO public function getPolicy($capability) { if ($capability == PhabricatorPolicyCapability::CAN_VIEW) { - return PhabricatorPolicies::POLICY_USER; + return $this->viewPolicy; } return PhabricatorPolicies::POLICY_NOONE; } diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php index 2990f95b5c..c27b94aae5 100644 --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -976,6 +976,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'sql', 'name' => $this->getPatchPath('ponder-comments.sql'), ), + 'pastepolicy.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('pastepolicy.sql'), + ), ); }