Skip to content

Commit

Permalink
Plugin: Azure: Catch exception when getting group members - refs BT#2…
Browse files Browse the repository at this point in the history
…1930
  • Loading branch information
AngelFQC committed Sep 17, 2024
1 parent 2b5eeb5 commit f5d563c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 9 additions & 3 deletions plugin/azure_active_directory/src/AzureSyncUsergroupsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ public function __invoke(): Generator

yield sprintf('Obtaining members for group (ID %d)', $groupId);

foreach ($this->getAzureGroupMembers($azureGroupUid) as $azureGroupMember) {
if ($userId = $this->plugin->getUserIdByVerificationOrder($azureGroupMember, 'id')) {
$newGroupMembers[] = $userId;
try {
foreach ($this->getAzureGroupMembers($azureGroupUid) as $azureGroupMember) {
if ($userId = $this->plugin->getUserIdByVerificationOrder($azureGroupMember, 'id')) {
$newGroupMembers[] = $userId;
}
}
} catch (Exception $e) {
yield $e->getMessage();

continue;
}

if ($newGroupMembers) {
Expand Down
9 changes: 8 additions & 1 deletion plugin/azure_active_directory/src/AzureSyncUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ public function __invoke(): Generator
$em = Database::getManager();

foreach ($roleGroups as $userRole => $groupUid) {
$azureGroupMembersInfo = iterator_to_array($this->getAzureGroupMembers($groupUid));
try {
$azureGroupMembersInfo = iterator_to_array($this->getAzureGroupMembers($groupUid));
} catch (Exception $e) {
yield $e->getMessage();

continue;
}

$azureGroupMembersUids = array_column($azureGroupMembersInfo, 'id');

foreach ($azureGroupMembersUids as $azureGroupMembersUid) {
Expand Down

0 comments on commit f5d563c

Please sign in to comment.