Add pull scope to post/put/patch method

Signed-off-by: 陈德 <chende@caicloud.io>
This commit is contained in:
陈德 2018-09-03 10:48:52 +08:00
parent 22c53d9f34
commit 6eb972c383
2 changed files with 4 additions and 5 deletions

View File

@ -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:

View File

@ -118,8 +118,7 @@ func TestParseScopes(t *testing.T) {
assert.EqualValues(t, &token.ResourceActions{
Type: "repository",
Name: "library/mysql/5.6",
Actions: []string{
"push"},
Actions: []string{"pull", "push"},
}, scopses[0])
// invalid