Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14043848
D7721.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
D7721.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 13, 1:24 PM (6 d, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6749127
Default Alt Text
D7721.diff (2 KB)
Attached To
Mode
D7721: Fix an error in the PolicyFilter algorithm
Attached
Detach File
Event Timeline
Log In to Comment