mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-15 07:43:27 +00:00
[EC-250] AU group next link (#272)
This commit is contained in:
@@ -201,15 +201,29 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
|||||||
}
|
}
|
||||||
|
|
||||||
const set = new Set<string>();
|
const set = new Set<string>();
|
||||||
|
const entryIds = new Set<string>();
|
||||||
const pieces = parts[1].split(",");
|
const pieces = parts[1].split(",");
|
||||||
|
|
||||||
if (keyword === "excludeadministrativeunit" || keyword === "includeadministrativeunit") {
|
if (keyword === "excludeadministrativeunit" || keyword === "includeadministrativeunit") {
|
||||||
for (const p of pieces) {
|
for (const p of pieces) {
|
||||||
const auMembers = await this.client
|
let auMembers = await this.client
|
||||||
.api(`https://graph.microsoft.com/v1.0/directory/administrativeUnits/${p}/members`)
|
.api(`https://graph.microsoft.com/v1.0/directory/administrativeUnits/${p}/members`)
|
||||||
.get();
|
.get();
|
||||||
for (const auMember of auMembers.value) {
|
// eslint-disable-next-line
|
||||||
if (auMember["@odata.type"] === "#microsoft.graph.group") {
|
while (true) {
|
||||||
set.add(auMember.displayName.toLowerCase());
|
for (const auMember of auMembers.value) {
|
||||||
|
const groupId = auMember.id;
|
||||||
|
if (auMember["@odata.type"] === "#microsoft.graph.group" && !entryIds.has(groupId)) {
|
||||||
|
set.add(auMember.displayName.toLowerCase());
|
||||||
|
entryIds.add(groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auMembers[NextLink] == null) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
const nextLinkReq = this.client.api(auMembers[NextLink]);
|
||||||
|
auMembers = await nextLinkReq.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user