-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for relying on entity queries to check access (#854)
- Loading branch information
1 parent
760e99e
commit 386c83f
Showing
8 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,7 @@ public function testQueries() { | |
*/ | ||
protected function developerQueryTest() { | ||
$result = $this->developerStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', "{$this->prefix}.test", 'STARTS_WITH') | ||
->condition('email', '@example.com', 'ENDS_WITH') | ||
->sort('lastName') | ||
|
@@ -145,6 +146,7 @@ protected function developerQueryTest() { | |
]), array_values($result)); | ||
|
||
$result = $this->developerStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', "{$this->prefix}.test", 'STARTS_WITH') | ||
->condition('email', '@example.com', 'ENDS_WITH') | ||
->sort('email') | ||
|
@@ -153,6 +155,7 @@ protected function developerQueryTest() { | |
$this->assertEquals(array_values(["{$this->prefix}[email protected]"]), array_values($result)); | ||
|
||
$result = $this->developerStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', "{$this->prefix}.test", 'STARTS_WITH') | ||
->condition('email', '@example.com', 'ENDS_WITH') | ||
->count() | ||
|
@@ -177,19 +180,22 @@ protected function smartQueryTest() { | |
// When primary id(s) of entities is set to something empty we should | ||
// get back an empty result. | ||
$result = $this->developerStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', NULL) | ||
->count() | ||
->execute(); | ||
$this->assertEquals(0, $result); | ||
|
||
$result = $this->developerStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('developerId', NULL) | ||
->count() | ||
->execute(); | ||
$this->assertEquals(0, $result); | ||
|
||
$developer = reset($this->edgeDevelopers); | ||
$result = $this->developerAppStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('developerId', $developer->getDeveloperId()) | ||
->count() | ||
->execute(); | ||
|
@@ -199,12 +205,14 @@ protected function smartQueryTest() { | |
// Edge by calling the proper API endpoint - is set to something empty | ||
// we should get back an empty result. | ||
$result = $this->developerAppStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('developerId', NULL) | ||
->count() | ||
->execute(); | ||
$this->assertEquals(0, $result); | ||
|
||
$result = $this->developerAppStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', $developer->getEmail()) | ||
->count() | ||
->execute(); | ||
|
@@ -214,6 +222,7 @@ protected function smartQueryTest() { | |
// Edge by calling the proper API endpoint - is set to something empty | ||
// we should get back an empty result. | ||
$result = $this->developerAppStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', NULL) | ||
->count() | ||
->execute(); | ||
|
@@ -222,6 +231,7 @@ protected function smartQueryTest() { | |
// If app name is set to something empty then query should not fail and | ||
// we should get back an empty list even if the developer has apps. | ||
$result = $this->developerAppStorage->getQuery() | ||
->accessCheck(FALSE) | ||
->condition('email', $developer->getEmail()) | ||
->condition('name', NULL) | ||
->count() | ||
|