Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services: add id to query parser #114

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invenio_users_resources/services/users/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class UserSearchOptions(SearchOptions, SearchOptionsMixin):
query_parser_cls = QueryParser.factory(
tree_transformer_cls=SearchFieldTransformer,
fields=["username^2", "email^2", "profile.full_name^3", "profile.affiliations"],
allow_list=["username", "email"], # mapped fields are added on the query parser
allow_list=["username", "email", "id"], # mapped fields are added on the query parser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some doubts if we should allow to search by ID, I think it enables it for everyone, not only admins

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it's independent of the visibility set in the profile, if visibility is set to hidden, then no one can find users by id. If is set to Public, users can be found by email, username and now ID as well

mapping={
"affiliation": "profile.affiliations",
"affiliations": "profile.affiliations",
Expand Down
Loading