Skip to content

Commit f40d041

Browse files
committed
Add paging to the graph API query
Graph API group query should have paging to be able to fetch all groups.
1 parent 9817539 commit f40d041

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

web/server/codechecker_server/api/authentication.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,17 @@ def performLogin(self, auth_method, auth_string):
389389
user_groups_url = oauth_config["user_groups_url"]
390390
response = oauth2_session.get(user_groups_url).json()
391391

392-
for group in response["value"]:
393-
if group.get("onPremisesSyncEnabled") and \
394-
group.get("securityEnabled"):
395-
groups.append(group["displayName"])
392+
morePages = True
393+
while morePages:
394+
for group in response["value"]:
395+
if group.get("onPremisesSyncEnabled") and \
396+
group.get("securityEnabled"):
397+
groups.append(group["displayName"])
398+
# paging of groups
399+
morePages = "@odata.nextLink" in response
400+
if morePages:
401+
response = oauth2_session.get(
402+
response["@odata.nextLink"]).json()
396403

397404
except Exception as ex:
398405
LOG.error("User info fetch failed: %s", str(ex))

0 commit comments

Comments
 (0)