Skip to content

Commit 98bf001

Browse files
author
epriestley
committed
Add viewPolicy and attachedToObjectPHID to PhabricatorFile
Summary: Ref T603. Principally, I want to implement the rule "when you upload a file to an object, users must be able to see the object in order to see the file", since I think this is strongly in line with user expectation. For example, if you attach a file to a Conpherence, it should only be visible to members of that thread. This adds storage for policies, but doesn't do anything interesting with it yet. Test Plan: Ran `bin/storage upgrade`. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D7175
1 parent 472be5e commit 98bf001

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE {$NAMESPACE}_file.file
2+
ADD viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin;
3+
4+
UPDATE {$NAMESPACE}_file.file
5+
SET viewPolicy = 'users' WHERE viewPolicy = '';

src/applications/files/storage/PhabricatorFile.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
3030

3131
protected $ttl;
3232
protected $isExplicitUpload = 1;
33+
protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
3334

3435
private $objects = self::ATTACHABLE;
3536
private $objectPHIDs = self::ATTACHABLE;

src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,10 @@ public function getPatches() {
16481648
'type' => 'sql',
16491649
'name' => $this->getPatchPath('20130927.audiomacro.sql'),
16501650
),
1651+
'20130929.filepolicy.sql' => array(
1652+
'type' => 'sql',
1653+
'name' => $this->getPatchPath('20130929.filepolicy.sql'),
1654+
),
16511655
);
16521656
}
16531657
}

0 commit comments

Comments
 (0)