Page MenuHomePhabricator

D7721.diff

diff --git a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php b/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
--- a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
+++ b/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.
*/
diff --git a/src/applications/policy/filter/PhabricatorPolicyFilter.php b/src/applications/policy/filter/PhabricatorPolicyFilter.php
--- a/src/applications/policy/filter/PhabricatorPolicyFilter.php
+++ b/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;
diff --git a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ b/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/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/v7/md/l2nhcsyj23nglwcs
Default Alt Text
D7721.diff (2 KB)

Event Timeline