Skip to content

Commit

Permalink
policy_api/provider: handle case of no suborgunits or groups in tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
rlxdev committed Feb 5, 2025
1 parent 5d39d76 commit c6aace9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scubagoggles/policy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def _get_groups(self) -> dict:

response = self._get(url, params)

for group_data in response['groups']:
for group_data in response.get('groups', ()):
group_id = group_data['id']
group_id_map[group_id] = group_data['name']

Expand Down
5 changes: 4 additions & 1 deletion scubagoggles/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ def call_gws_providers(self, products: list, quiet) -> dict:
ou_ids.add(self._top_ou)
# get all organizational unit data
product_to_items['organizational_units'] = self.get_ous()
for orgunit in product_to_items['organizational_units']['organizationUnits']:
orgunits = product_to_items['organizational_units']
sub_orgunits = orgunits.get('organizationUnits', ())

for orgunit in sub_orgunits:
ou_ids.add(orgunit['name'])
# add just organizational unit names to a field]
product_to_items['organizational_unit_names'] = list(ou_ids)
Expand Down

0 comments on commit c6aace9

Please sign in to comment.