1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-30 16:38:21 +01:00

Add paste policy storage

Summary: Add storage to Pastes for view policies.

Test Plan: Set policies on pastes, see next diff.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D3474
This commit is contained in:
epriestley 2012-09-13 10:11:14 -07:00
parent 5883b4f50c
commit b39175342d
3 changed files with 11 additions and 1 deletions

View file

@ -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;

View file

@ -25,6 +25,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO
protected $filePHID; protected $filePHID;
protected $language; protected $language;
protected $parentPHID; protected $parentPHID;
protected $viewPolicy;
private $content; private $content;
@ -52,7 +53,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO
public function getPolicy($capability) { public function getPolicy($capability) {
if ($capability == PhabricatorPolicyCapability::CAN_VIEW) { if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
return PhabricatorPolicies::POLICY_USER; return $this->viewPolicy;
} }
return PhabricatorPolicies::POLICY_NOONE; return PhabricatorPolicies::POLICY_NOONE;
} }

View file

@ -976,6 +976,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql', 'type' => 'sql',
'name' => $this->getPatchPath('ponder-comments.sql'), 'name' => $this->getPatchPath('ponder-comments.sql'),
), ),
'pastepolicy.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('pastepolicy.sql'),
),
); );
} }