Skip to content

Commit

Permalink
Merge pull request #2965 from cli/writeorg-oauth-scope
Browse files Browse the repository at this point in the history
Recognize the `write:org` OAuth scope as satisfying `read:org`
  • Loading branch information
mislav committed Feb 17, 2021
2 parents 3a224b7 + 4a49e35 commit faa6981
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cmd/auth/shared/oauth_scopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func HasMinimumScopes(httpClient httpClient, hostname, authToken string) error {
missingScopes = append(missingScopes, "repo")
}

if !search["read:org"] && !search["admin:org"] {
if !search["read:org"] && !search["write:org"] && !search["admin:org"] {
missingScopes = append(missingScopes, "read:org")
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/auth/shared/oauth_scopes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func Test_HasMinimumScopes(t *testing.T) {
header: "repo, admin:org",
wantErr: "",
},
{
name: "write:org satisfies read:org",
header: "repo, write:org",
wantErr: "",
},
{
name: "insufficient scope",
header: "repo",
Expand Down

0 comments on commit faa6981

Please sign in to comment.