Skip to content

Commit 1995e4b

Browse files
authored
feat: Add option to filter teams by product (#234)
1 parent 9c532b6 commit 1995e4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sdcclient/_common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,13 @@ def edit_user(self, user_email, firstName=None, lastName=None, systemRole=None):
699699
return [False, self.lasterr]
700700
return [True, 'Successfully edited user']
701701

702-
def get_teams(self, team_filter=''):
702+
def get_teams(self, team_filter='', product_filter=''):
703703
'''**Description**
704704
Return the set of teams that match the filter specified. The *team_filter* should be a substring of the names of the teams to be returned.
705705
706706
**Arguments**
707707
- **team_filter**: the team filter to match when returning the list of teams
708+
- **product_filter**: the product to match when returning the list of teams (SDC-Monitor, SDS-secure)
708709
709710
**Success Return Value**
710711
The teams that match the filter.
@@ -713,6 +714,8 @@ def get_teams(self, team_filter=''):
713714
if not self._checkResponse(res):
714715
return [False, self.lasterr]
715716
ret = [t for t in res.json()['teams'] if team_filter in t['name']]
717+
if product_filter:
718+
ret = [t for t in ret if product_filter in t['products']]
716719
return [True, ret]
717720

718721
def get_team(self, name):

0 commit comments

Comments
 (0)