Repository navigation
Closed
Labels
api-repositoriesWork to complete the API's defined here: https://developer.github.com/v3/repos/Work to complete the API's defined here: https://developer.github.com/v3/repos/bugThis relates to a bug in the existing module.This relates to a bug in the existing module.in progressWork on this issue is already underway. Please don't work start new work on it.Work on this issue is already underway. Please don't work start new work on it.
Description
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:
| 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 both push and maintain 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 maintainThis problem was originally identified by Mark (@tigerfansga) in #194
Suggested solution to the issue
Switch the order of the conditionals here:
PowerShellForGitHub/GitHubRepositories.ps1
Lines 3928 to 3935 in 22e3d7b
| elseif ($result.permissions.push) | |
| { | |
| $permission = 'push' | |
| } | |
| elseif ($result.permissions.maintain) | |
| { | |
| $permission = 'maintain' | |
| } |
Requested Assignment
- If possible, I would like to fix this.
Operating System
OsName : Microsoft Windows 11 Pro
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 22000.1.amd64fre.co_release.210604-1628
OsLanguage : en-US
OsMuiLanguages : {en-US}
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22000.653
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.653
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module Version
Running: 0.16.1
Installed:
Metadata
Metadata
Assignees
Labels
api-repositoriesWork to complete the API's defined here: https://developer.github.com/v3/repos/Work to complete the API's defined here: https://developer.github.com/v3/repos/bugThis relates to a bug in the existing module.This relates to a bug in the existing module.in progressWork on this issue is already underway. Please don't work start new work on it.Work on this issue is already underway. Please don't work start new work on it.
Activity