Skip to content

Commit

Permalink
Merge pull request #16 from onna/search-attr
Browse files Browse the repository at this point in the history
- Support searching on multiple attributes
  • Loading branch information
gitcarbs authored Oct 20, 2019
2 parents 2042765 + 9579fd7 commit b5198ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
5.0.0 (unreleased)
5.0.1 (2019-10-18)
------------------
- Support searching on multiple attributes

5.0.0 (2019-08-29)
------------------

- g5 support
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0.dev0
5.0.1
9 changes: 6 additions & 3 deletions guillotina_oauth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,21 @@ async def get_users(self, request):
return result
getUsers = get_users

async def search_users(self, request, page=0, num_x_page=30, term='', search_attr='mail'):
async def search_users(self, request, page=0, num_x_page=30, term='', search_attr=['mail']):
container = task_vars.container.get()
scope = container.id
header = {
'Authorization': request.headers['Authorization']
}

criteria = {search_attr: f"{term}*"}
criteria = {}
for attr in search_attr:
criteria[attr] = f"{term}"

payload = {
'criteria': json.dumps(criteria),
'exact_match': False,
'attrs': f'["{search_attr}"]',
'attrs': json.dumps(search_attr),
'page': page,
'num_x_page': num_x_page,
'service_token': await self.service_token,
Expand Down

0 comments on commit b5198ef

Please sign in to comment.