Add Filter parameter for cognitoidp list_users()
This commit is contained in:
parent
fda0f3e661
commit
4bae0339c2
@ -279,9 +279,13 @@ class CognitoIdpResponse(BaseResponse):
|
|||||||
user_pool_id = self._get_param("UserPoolId")
|
user_pool_id = self._get_param("UserPoolId")
|
||||||
limit = self._get_param("Limit")
|
limit = self._get_param("Limit")
|
||||||
token = self._get_param("PaginationToken")
|
token = self._get_param("PaginationToken")
|
||||||
|
filt = self._get_param("Filter")
|
||||||
users, token = cognitoidp_backends[self.region].list_users(
|
users, token = cognitoidp_backends[self.region].list_users(
|
||||||
user_pool_id, limit=limit, pagination_token=token
|
user_pool_id, limit=limit, pagination_token=token
|
||||||
)
|
)
|
||||||
|
if filt:
|
||||||
|
name, value = filt.replace('"', '').split('=')
|
||||||
|
users = [user for user in users for attribute in user.attributes if attribute['Name'] == name and attribute['Value'] == value]
|
||||||
response = {"Users": [user.to_json(extended=True) for user in users]}
|
response = {"Users": [user.to_json(extended=True) for user in users]}
|
||||||
if token:
|
if token:
|
||||||
response["PaginationToken"] = str(token)
|
response["PaginationToken"] = str(token)
|
||||||
|
Loading…
Reference in New Issue
Block a user