When the feature was introduced in #300, an additional property called permission was added to the returned object which was supposed to summarize the maximum permission level that a team has been granted. This is what that permission table looks like:
name
permissions granted
pull
pull
triage
pull, triage
push
pull, triage, push
maintain
pull, triage, push, maintain
admin
pull, triage, push, maintain, admin
Unfortunately, the logic treated push as more powerful that maintain, and thus it always sets the new permission property to push for bothpushandmaintain teams.
Steps to reproduce the issue
$repoName = [Guid]::NewGuid().Guid
$organizationName = 'PowerShellForGitHubTeamTestOrg'
$repo = New-GitHubRepository -OrganizationName $organizationName -RepositoryName $repoName
$teamName = [Guid]::NewGuid().Guid
$team = New-GitHubTeam -OrganizationName $organizationName -TeamName $teamName -Description 'foo' -Privacy 'closed' -MaintainerName 'PowerShellForGitHubTeam'
Set-GitHubRepositoryTeamPermission -Uri $repo.svn_url -TeamSlug $team.slug -Permission maintain
$permission = Get-GitHubRepositoryTeamPermission -Uri $repo.svn_url -TeamSlug $team.slug
$permission.permissions # Note here that maintain is set to true
$permission.permission # Note that it's returning push instead of maintain
This problem was originally identified by @tigerfansga in #194
Issue Details
When the feature was introduced in #300, an additional property called
permission
was added to the returned object which was supposed to summarize the maximum permission level that a team has been granted. This is what that permission table looks like:Unfortunately, the logic treated
push
as more powerful thatmaintain
, and thus it always sets the newpermission
property topush
for bothpush
andmaintain
teams.Steps to reproduce the issue
Suggested solution to the issue
Switch the order of the conditionals here:
https://github.com/microsoft/PowerShellForGitHub/blob/22e3d7bdf6c3b33fdead74dac831e0bb43beb2c4/GitHubRepositories.ps1#L3928-L3935
Requested Assignment
Operating System
PowerShell Version
Module Version