-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude user from jsonapi response for account links (#634)
- Loading branch information
Showing
3 changed files
with
22 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,17 @@ public void restrictedResultWithoutScope() throws Exception { | |
.andExpect(jsonPath("$.data[1].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[2].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[3].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[0].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[1].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[2].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[3].relationships", not(hasKey("accountLinks")))) | ||
// you are allowed to see your own stuff | ||
.andExpect(jsonPath("$.data[4].attributes.email", is("[email protected]"))) | ||
.andExpect(jsonPath("$.data[4].attributes.recentIpAddress", is("127.0.0.1"))) | ||
.andExpect(jsonPath("$.data[4].attributes", hasKey("lastLogin"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("reporterOnModerationReports"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("userGroups"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("accountLinks"))) | ||
// you cannot see your uuid | ||
.andExpect(jsonPath("$.data[4].relationships", not(hasKey("uniqueIds")))) | ||
// nobody can see passwords! | ||
|
@@ -104,12 +111,17 @@ public void restrictedResultWithoutRole() throws Exception { | |
.andExpect(jsonPath("$.data[1].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[2].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[3].relationships", not(hasKey("uniqueIds")))) | ||
.andExpect(jsonPath("$.data[0].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[1].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[2].relationships", not(hasKey("accountLinks")))) | ||
.andExpect(jsonPath("$.data[3].relationships", not(hasKey("accountLinks")))) | ||
// you are allowed to see your own stuff | ||
.andExpect(jsonPath("$.data[4].attributes.email", is("[email protected]"))) | ||
.andExpect(jsonPath("$.data[4].attributes.recentIpAddress", is("127.0.0.1"))) | ||
.andExpect(jsonPath("$.data[4].attributes", hasKey("lastLogin"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("reporterOnModerationReports"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("userGroups"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("accountLinks"))) | ||
// you cannot see your uuid | ||
.andExpect(jsonPath("$.data[4].relationships", not(hasKey("uniqueIds")))) | ||
// nobody can see passwords! | ||
|
@@ -162,6 +174,11 @@ public void canSeePrivateDetailsWithScopeAndRole() throws Exception { | |
.andExpect(jsonPath("$.data[2].relationships", hasKey("uniqueIds"))) | ||
.andExpect(jsonPath("$.data[3].relationships", hasKey("uniqueIds"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("uniqueIds"))) | ||
.andExpect(jsonPath("$.data[0].relationships", hasKey("accountLinks"))) | ||
.andExpect(jsonPath("$.data[1].relationships", hasKey("accountLinks"))) | ||
.andExpect(jsonPath("$.data[2].relationships", hasKey("accountLinks"))) | ||
.andExpect(jsonPath("$.data[3].relationships", hasKey("accountLinks"))) | ||
.andExpect(jsonPath("$.data[4].relationships", hasKey("accountLinks"))) | ||
// cannot see others reporterOnModerationReports | ||
.andExpect(jsonPath("$.data[0].relationships", not(hasKey("reporterOnModerationReports")))) | ||
.andExpect(jsonPath("$.data[1].relationships", not(hasKey("reporterOnModerationReports")))) | ||
|
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