Skip to content

Commit

Permalink
Merge pull request #5781 from cd1989/insufficient-scope-problem
Browse files Browse the repository at this point in the history
Add pull scope to post/put/patch method
  • Loading branch information
ywk253100 committed Sep 3, 2018
2 parents 179d7be + 6eb972c commit c4fc79e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/common/utils/registry/auth/tokenauthorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func parseScopes(req *http.Request) ([]*token.ResourceActions, error) {
case http.MethodGet, http.MethodHead:
scope.Actions = []string{"pull"}
case http.MethodPost, http.MethodPut, http.MethodPatch:
scope.Actions = []string{"push"}
scope.Actions = []string{"pull", "push"}
case http.MethodDelete:
scope.Actions = []string{"*"}
default:
Expand Down
7 changes: 3 additions & 4 deletions src/common/utils/registry/auth/tokenauthorizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ func TestParseScopes(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 1, len(scopses))
assert.EqualValues(t, &token.ResourceActions{
Type: "repository",
Name: "library/mysql/5.6",
Actions: []string{
"push"},
Type: "repository",
Name: "library/mysql/5.6",
Actions: []string{"pull", "push"},
}, scopses[0])

// invalid
Expand Down

0 comments on commit c4fc79e

Please sign in to comment.