Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15440349
D8111.id18354.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8111.id18354.diff
View Options
Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -2197,6 +2197,7 @@
'PhluxVariableQuery' => 'applications/phlux/query/PhluxVariableQuery.php',
'PhluxViewController' => 'applications/phlux/controller/PhluxViewController.php',
'PholioActionMenuEventListener' => 'applications/pholio/event/PholioActionMenuEventListener.php',
+ 'PholioCapabilityDefaultView' => 'applications/pholio/capability/PholioCapabilityDefaultView.php',
'PholioConstants' => 'applications/pholio/constants/PholioConstants.php',
'PholioController' => 'applications/pholio/controller/PholioController.php',
'PholioDAO' => 'applications/pholio/storage/PholioDAO.php',
@@ -4938,6 +4939,7 @@
'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhluxViewController' => 'PhluxController',
'PholioActionMenuEventListener' => 'PhabricatorEventListener',
+ 'PholioCapabilityDefaultView' => 'PhabricatorPolicyCapability',
'PholioController' => 'PhabricatorController',
'PholioDAO' => 'PhabricatorLiskDAO',
'PholioImage' =>
Index: src/applications/pholio/application/PhabricatorApplicationPholio.php
===================================================================
--- src/applications/pholio/application/PhabricatorApplicationPholio.php
+++ src/applications/pholio/application/PhabricatorApplicationPholio.php
@@ -82,4 +82,11 @@
return $items;
}
+ protected function getCustomCapabilities() {
+ return array(
+ PholioCapabilityDefaultView::CAPABILITY => array(
+ ),
+ );
+ }
+
}
Index: src/applications/pholio/capability/PholioCapabilityDefaultView.php
===================================================================
--- /dev/null
+++ src/applications/pholio/capability/PholioCapabilityDefaultView.php
@@ -0,0 +1,20 @@
+<?php
+
+final class PholioCapabilityDefaultView
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'pholio.default.view';
+
+ public function getCapabilityKey() {
+ return self::CAPABILITY;
+ }
+
+ public function getCapabilityName() {
+ return pht('Default View Policy');
+ }
+
+ public function shouldAllowPublicPolicySetting() {
+ return true;
+ }
+
+}
Index: src/applications/pholio/controller/PholioMockEditController.php
===================================================================
--- src/applications/pholio/controller/PholioMockEditController.php
+++ src/applications/pholio/controller/PholioMockEditController.php
@@ -38,10 +38,7 @@
$files = mpull($mock_images, 'getFile');
$mock_images = mpull($mock_images, null, 'getFilePHID');
} else {
- $mock = id(new PholioMock())
- ->setAuthorPHID($user->getPHID())
- ->attachImages(array())
- ->setViewPolicy(PhabricatorPolicies::POLICY_USER);
+ $mock = PholioMock::initializeNewMock($user);
$title = pht('Create Mock');
Index: src/applications/pholio/storage/PholioMock.php
===================================================================
--- src/applications/pholio/storage/PholioMock.php
+++ src/applications/pholio/storage/PholioMock.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group pholio
- */
final class PholioMock extends PholioDAO
implements
PhabricatorMarkupInterface,
@@ -28,6 +25,20 @@
private $coverFile = self::ATTACHABLE;
private $tokenCount = self::ATTACHABLE;
+ public static function initializeNewMock(PhabricatorUser $actor) {
+ $app = id(new PhabricatorApplicationQuery())
+ ->setViewer($actor)
+ ->withClasses(array('PhabricatorApplicationPholio'))
+ ->executeOne();
+
+ $view_policy = $app->getPolicy(PholioCapabilityDefaultView::CAPABILITY);
+
+ return id(new PholioMock())
+ ->setAuthorPHID($actor->getPHID())
+ ->attachImages(array())
+ ->setViewPolicy($view_policy);
+ }
+
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 27, 12:20 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587550
Default Alt Text
D8111.id18354.diff (3 KB)
Attached To
Mode
D8111: Add a defualt view policy for Pholio
Attached
Detach File
Event Timeline
Log In to Comment