Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
# https://developer.okta.com/docs/reference/api/apps/#list-users-assigned-to-application
if next_url:
paged_response = api_client.get(next_url)
else:
params = {
'limit': 500,
}
paged_response = api_client.get_path(f'/{app_id}/users', params)
except OktaError as okta_error:
logger.debug(f"Got error while going through list application assigned users {okta_error}")
break
app_users.append(paged_response.text)
if not is_last_page(paged_response):
next_url = paged_response.links.get("next").get("url")
else:
break
return app_users
while True:
# https://developer.okta.com/docs/reference/api/groups/#list-groups
if next_url:
paged_response = api_client.get(next_url)
else:
params = {
'limit': 10000,
}
paged_response = api_client.get_path('/', params)
paged_results = PagedResults(paged_response, UserGroup)
group_list.extend(paged_results.result)
if not is_last_page(paged_response):
next_url = paged_response.links.get("next").get("url")
else:
break
return group_list
while True:
try:
if next_url:
paged_response = api_client.get(next_url)
else:
params = {
'limit': 500,
}
paged_response = api_client.get_path(f'/{app_id}/groups', params)
except OktaError as okta_error:
logger.debug(f"Got error while going through list application assigned groups {okta_error}")
break
app_groups.append(paged_response.text)
if not is_last_page(paged_response):
next_url = paged_response.links.get("next").get("url")
else:
break
return app_groups
try:
# https://developer.okta.com/docs/reference/api/groups/#list-group-members
if next_url:
paged_response = api_client.get(next_url)
else:
params = {
'limit': 1000,
}
paged_response = api_client.get_path(f'/{group_id}/users', params)
except OktaError as okta_error:
logger.debug(f"Got error while going through list group member {okta_error}")
break
member_list.append(paged_response.text)
if not is_last_page(paged_response):
next_url = paged_response.links.get("next").get("url")
else:
break
return member_list