Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15443242
D16382.id39400.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16382.id39400.diff
View Options
diff --git a/src/applications/herald/controller/HeraldRuleViewController.php b/src/applications/herald/controller/HeraldRuleViewController.php
--- a/src/applications/herald/controller/HeraldRuleViewController.php
+++ b/src/applications/herald/controller/HeraldRuleViewController.php
@@ -2,6 +2,10 @@
final class HeraldRuleViewController extends HeraldController {
+ public function shouldAllowPublic() {
+ return true;
+ }
+
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/src/applications/herald/storage/HeraldRule.php
@@ -288,39 +288,40 @@
}
public function getPolicy($capability) {
+ if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
+ return PhabricatorPolicies::getMostOpenPolicy();
+ }
+
if ($this->isGlobalRule()) {
- switch ($capability) {
- case PhabricatorPolicyCapability::CAN_VIEW:
- return PhabricatorPolicies::POLICY_USER;
- case PhabricatorPolicyCapability::CAN_EDIT:
- $app = 'PhabricatorHeraldApplication';
- $herald = PhabricatorApplication::getByClass($app);
- $global = HeraldManageGlobalRulesCapability::CAPABILITY;
- return $herald->getPolicy($global);
- }
+ $app = 'PhabricatorHeraldApplication';
+ $herald = PhabricatorApplication::getByClass($app);
+ $global = HeraldManageGlobalRulesCapability::CAPABILITY;
+ return $herald->getPolicy($global);
} else if ($this->isObjectRule()) {
return $this->getTriggerObject()->getPolicy($capability);
} else {
- return PhabricatorPolicies::POLICY_NOONE;
+ return $this->getAuthorPHID();
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
- if ($this->isPersonalRule()) {
- return ($viewer->getPHID() == $this->getAuthorPHID());
- } else {
- return false;
- }
+ return false;
}
public function describeAutomaticCapability($capability) {
- if ($this->isPersonalRule()) {
- return pht("A personal rule's owner can always view and edit it.");
- } else if ($this->isObjectRule()) {
- return pht('Object rules inherit the policies of their objects.');
+ if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
+ return null;
}
- return null;
+ if ($this->isGlobalRule()) {
+ return pht(
+ 'Global Herald rules can be edited by users with the "Can Manage '.
+ 'Global Rules" Herald application permission.');
+ } else if ($this->isObjectRule()) {
+ return pht('Object rules inherit the edit policies of their objects.');
+ } else {
+ return pht('A personal rule can only be edited by its owner.');
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 3:16 AM (5 d, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7327666
Default Alt Text
D16382.id39400.diff (2 KB)
Attached To
Mode
D16382: Let everyone view Herald rules
Attached
Detach File
Event Timeline
Log In to Comment