mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-03 06:28:06 +01:00
Add pull scope to post/put/patch method
Signed-off-by: 陈德 <chende@caicloud.io>
This commit is contained in:
parent
22c53d9f34
commit
6eb972c383
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user