-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1444 from plone/users-endpoint-search-fullname
@users: Support search for fullname, email, id with `?search=` Do you release, @tisto ?
- Loading branch information
Showing
9 changed files
with
137 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@users: Support search for fullname, email, id with ?search= [ksuess] |
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
2 changes: 1 addition & 1 deletion
2
src/plone/restapi/tests/http-examples/users_filtered_by_username.req
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
GET /plone/@users?query=noa HTTP/1.1 | ||
GET /plone/@users?query=oam HTTP/1.1 | ||
Accept: application/json | ||
Authorization: Basic YWRtaW46c2VjcmV0 |
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ Content-Type: application/json | |
"email": "[email protected]", | ||
"fullname": "Noam Avram Chomsky", | ||
"groups": { | ||
"@id": "http://localhost:55001/plone/@users?query=noa", | ||
"@id": "http://localhost:55001/plone/@users?query=oam", | ||
"items": [ | ||
{ | ||
"id": "AuthenticatedUsers", | ||
|
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
GET /plone/@users?search=avram HTTP/1.1 | ||
Accept: application/json | ||
Authorization: Basic YWRtaW46c2VjcmV0 |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
|
||
[ | ||
{ | ||
"@id": "http://localhost:55001/plone/@users/noam", | ||
"description": "Professor of Linguistics", | ||
"email": "[email protected]", | ||
"fullname": "Noam Avram Chomsky", | ||
"groups": { | ||
"@id": "http://localhost:55001/plone/@users?search=avram", | ||
"items": [ | ||
{ | ||
"id": "AuthenticatedUsers", | ||
"title": "AuthenticatedUsers" | ||
}, | ||
{ | ||
"id": "Reviewers", | ||
"title": "Reviewers" | ||
} | ||
], | ||
"items_total": 2 | ||
}, | ||
"home_page": "web.mit.edu/chomsky", | ||
"id": "noam", | ||
"location": "Cambridge, MA", | ||
"portrait": null, | ||
"roles": [ | ||
"Member", | ||
"Reviewer" | ||
], | ||
"username": "noam" | ||
} | ||
] |
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 |
---|---|---|
|
@@ -936,7 +936,7 @@ def test_documentation_users_filtered_get(self): | |
api.group.add_user(groupname="Reviewers", username="noam") | ||
transaction.commit() | ||
# filter by username | ||
response = self.api_session.get("@users", params={"query": "noa"}) | ||
response = self.api_session.get("@users", params={"query": "oam"}) | ||
save_request_and_response_for_docs("users_filtered_by_username", response) | ||
# filter by groups | ||
response = self.api_session.get( | ||
|
@@ -945,6 +945,22 @@ def test_documentation_users_filtered_get(self): | |
) | ||
save_request_and_response_for_docs("users_filtered_by_groups", response) | ||
|
||
def test_documentation_users_searched_get(self): | ||
properties = { | ||
"fullname": "Noam Avram Chomsky", | ||
"home_page": "web.mit.edu/chomsky", | ||
"description": "Professor of Linguistics", | ||
"location": "Cambridge, MA", | ||
} | ||
api.user.create( | ||
email="[email protected]", username="noam", properties=properties | ||
) | ||
api.group.add_user(groupname="Reviewers", username="noam") | ||
transaction.commit() | ||
# search by fullname | ||
response = self.api_session.get("@users", params={"search": "avram"}) | ||
save_request_and_response_for_docs("users_searched", response) | ||
|
||
def test_documentation_users_created(self): | ||
response = self.api_session.post( | ||
"/@users", | ||
|