Skip to content

Commit 735d0e2

Browse files
razdob15Chaffelson
andauthored
Fix searching by unique identifier (Chaffelson#205)
* Fix the search according unique identifier * Fix the search according unique identifier and update functions doc * Minor typo correction Co-authored-by: Dan Chaffelson <chaffelson@gmail.com>
1 parent f9e2c24 commit 735d0e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nipyapi/security.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ def list_service_users(service='nifi'):
4444

4545
def get_service_user(identifier, identifier_type='identity', service='nifi'):
4646
"""
47-
Filters the all users list for a given identifier and type
47+
Gets the unique user matching to the given identifier and type.
4848
4949
Args:
5050
identifier (str): the string to search for
5151
identifier_type (str): the field to search in
5252
service (str): the name of the service
5353
5454
Returns:
55-
None if no match, list of multiple matches, else single object
55+
None if no match, else single object
5656
5757
"""
5858
assert service in _valid_services
5959
assert isinstance(identifier, six.string_types)
6060
assert isinstance(identifier_type, six.string_types)
6161
obj = list_service_users(service)
62-
out = nipyapi.utils.filter_obj(obj, identifier, identifier_type)
62+
out = nipyapi.utils.filter_obj(obj, identifier, identifier_type, greedy=False)
6363
return out
6464

6565

@@ -212,22 +212,22 @@ def list_service_user_groups(service='nifi'):
212212
def get_service_user_group(identifier, identifier_type='identity',
213213
service='nifi'):
214214
"""
215-
Filters the all groups list for a given identifier and type
215+
Gets the unique group matching to the given identifier and type.
216216
217217
Args:
218218
identifier (str): the string to search for
219219
identifier_type (str): the field to search in, identity or id
220220
service (str): the name of the service
221221
222222
Returns:
223-
None if no match, list of multiple matches, else single object
223+
None if no match, else single object
224224
225225
"""
226226
assert service in _valid_services
227227
assert isinstance(identifier, six.string_types)
228228
assert isinstance(identifier_type, six.string_types)
229229
obj = list_service_user_groups(service)
230-
out = nipyapi.utils.filter_obj(obj, identifier, identifier_type)
230+
out = nipyapi.utils.filter_obj(obj, identifier, identifier_type, greedy=False)
231231
return out
232232

233233

0 commit comments

Comments
 (0)