Merge pull request #2965 from cli/writeorg-oauth-scope

Recognize the `write:org` OAuth scope as satisfying `read:org`
This commit is contained in:
Mislav Marohnić 2021-02-17 17:26:16 +01:00 committed by GitHub
commit faa6981f46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -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")
}

View file

@ -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",