Page MenuHomePhabricator

D7721.diff
No OneTemporary

D7721.diff

Index: src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
===================================================================
--- src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
+++ src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
@@ -227,6 +227,35 @@
}
}
+ public function testMultipleCapabilities() {
+ $object = new PhabricatorPolicyTestObject();
+ $object->setCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ));
+ $object->setPolicies(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW
+ => PhabricatorPolicies::POLICY_USER,
+ PhabricatorPolicyCapability::CAN_EDIT
+ => PhabricatorPolicies::POLICY_NOONE,
+ ));
+
+ $filter = new PhabricatorPolicyFilter();
+ $filter->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ));
+ $filter->setViewer($this->buildUser('user'));
+
+ $result = $filter->apply(array($object));
+
+ $this->assertEqual(array(), $result);
+ }
+
+
/**
* Test an object for visibility across multiple user specifications.
*/
Index: src/applications/policy/filter/PhabricatorPolicyFilter.php
===================================================================
--- src/applications/policy/filter/PhabricatorPolicyFilter.php
+++ src/applications/policy/filter/PhabricatorPolicyFilter.php
@@ -156,10 +156,10 @@
// If we're missing any capability, move on to the next object.
continue 2;
}
-
- // If we make it here, we have all of the required capabilities.
- $filtered[$key] = $object;
}
+
+ // If we make it here, we have all of the required capabilities.
+ $filtered[$key] = $object;
}
return $filtered;
Index: src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
===================================================================
--- src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
@@ -109,7 +109,7 @@
* @task config
*/
final public function shouldRaisePolicyExceptions() {
- return (bool) $this->raisePolicyExceptions;
+ return (bool)$this->raisePolicyExceptions;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 25, 7:29 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6749127
Default Alt Text
D7721.diff (2 KB)

Event Timeline