mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-29 16:08:22 +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:
parent
5883b4f50c
commit
b39175342d
3 changed files with 11 additions and 1 deletions
5
resources/sql/patches/pastepolicy.sql
Normal file
5
resources/sql/patches/pastepolicy.sql
Normal 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;
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue