Add option to disable partial autocompletion of users

This commit is contained in:
Joseph Schorr 2017-09-12 15:55:37 -04:00
parent 6600b380ca
commit c6aad5fef0
4 changed files with 29 additions and 2 deletions

View file

@ -1,5 +1,7 @@
""" Conduct searches against all registry context. """
import features
from endpoints.api import (ApiResource, parse_args, query_param, truthy_bool, nickname, resource,
require_scope, path_param, internal_only, Unauthorized, InvalidRequest,
show_if)
@ -107,7 +109,8 @@ class EntitySearch(ApiResource):
robot_namespace = namespace_name
# Lookup users in the database for the prefix query.
users = model.user.get_matching_users(prefix, robot_namespace, organization, limit=10)
users = model.user.get_matching_users(prefix, robot_namespace, organization, limit=10,
exact_matches_only=not features.PARTIAL_USER_AUTOCOMPLETE)
# Lookup users via the user system for the prefix query. We'll filter out any users that
# already exist in the database.