Given a Jira group of exactly 51 members, Get-JiraGroupMember is only returning the first 50 users
Add one additional member to the group, bringing the number of members to 52, and all 52 members are returned.
I have not tested but I surmise that the problem occurs for groups where the number of members is n * $PageSize + 1
Expected Behavior
Get-JiraGroupMember should return all members of the group no matter how many members of the group there are.
Current Behavior
Given a valid Jira group containing exactly 51 members, Get-JiraGroupMember will only return the first 50 members.
Possible Solution
The problem manifests in Invoke-JiraMethod. The first 50 members have already been successfully processed. The JSON with the 51st member has been returned by the Jira server. The data container is expanded:
$result = $response.$container
There is only a single object. The subsequent while loop then calls .Count} while ($result.Count)
however $result is a PSCustomObject with no Count member. Count evaluates to $null. The while loop therefore exits and the final group member is not processed
I'm not sure of the best appraoch to fixing.
Steps to Reproduce (for bugs)
Given a Jira group called "TestGroup" which has exactly 51 members and an existing server connect:
1.$groupMembers = Get-JiraGroupMember "TestGroup"
$groupMembers.Count
Context
Your Environment
Get-Module JiraPS -ListAvailable | select version
Version
-------
2.8.3
2.8.2
2.8.1
2.8.0
2.4.4
Get-Module JiraPS
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.8.3 JiraPS {Add-JiraFilterPermission, Add-JiraGroupMember, Add-JiraIssueAttachment, Add-JiraIssueComment...}
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.165
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.165
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Given a Jira group of exactly 51 members, Get-JiraGroupMember is only returning the first 50 users Add one additional member to the group, bringing the number of members to 52, and all 52 members are returned.
I have not tested but I surmise that the problem occurs for groups where the number of members is n * $PageSize + 1
Expected Behavior
Get-JiraGroupMember should return all members of the group no matter how many members of the group there are.
Current Behavior
Given a valid Jira group containing exactly 51 members, Get-JiraGroupMember will only return the first 50 members.
Possible Solution
The problem manifests in Invoke-JiraMethod. The first 50 members have already been successfully processed. The JSON with the 51st member has been returned by the Jira server. The data container is expanded:
$result = $response.$container
There is only a single object. The subsequent while loop then calls.Count
} while ($result.Count)
however$result
is a PSCustomObject with no Count member. Count evaluates to$null
. The while loop therefore exits and the final group member is not processedI'm not sure of the best appraoch to fixing.
Steps to Reproduce (for bugs)
Given a Jira group called "TestGroup" which has exactly 51 members and an existing server connect: 1.$groupMembers = Get-JiraGroupMember "TestGroup"
Context
Your Environment