Handling pagination for user groups

Created on 9 May 2024, about 2 months ago

Problem/Motivation

The user group API endpoint has a default limit of 100 groups by request. This means that if a user has >100 user groups, we only get the first 100 and none of the rest.

We need to handle pagination to fetch the rest.

Steps to reproduce

It's not practical to test with 100 user groups... these are steps to simulate the issue with fewer groups.

1. Create a user in AD with more than ~10 user groups
2. In the module config, create role mappings for all 10 user groups
2. Manually change the endpoint URL from `https://graph.microsoft.com/v1.0/me/memberOf` to `https://graph.microsoft.com/v1.0/me/memberOf?$top=5` (limiting to 5 per page) and create mappings for all
3. See how not all roles are assigned to the user when they login

Proposed resolution

Check the response for a `nextLink`, and when present, request subsequent pages.

Remaining tasks

Implementation

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom khaled.zaidan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024