Skip to content

Commit

Permalink
fix(auth): topup and stewardship roles (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
notanatol authored Nov 11, 2021
1 parent 04f6c81 commit 02fc4ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/bee/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ var policies = [][]string{
{"maintainer", "/stamps", "GET"},
{"maintainer", "/stamps/*", "GET"},
{"maintainer", "/stamps/*/*", "POST"},
{"maintainer", "/stamps/topup/*/*", "PATCH"},
{"maintainer", "/stamps/dilute/*/*", "PATCH"},
{"maintainer", "/addresses", "GET"},
{"maintainer", "/blocklist", "GET"},
{"maintainer", "/connect/*", "POST"},
Expand Down Expand Up @@ -163,5 +165,6 @@ var policies = [][]string{
{"consumer", "/consumed", "GET"},
{"consumer", "/consumed/*", "GET"},
{"consumer", "/chunks/stream", "GET"},
{"creator", "/stewardship/*", "GET"},
{"consumer", "/stewardship/*", "PUT"},
}
2 changes: 2 additions & 0 deletions pkg/bee/api/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ func TestGetRole(t *testing.T) {
{desc: "multi method 2", expectedRole: "creator", path: "/tags", method: "GET"},
{desc: "one level", expectedRole: "consumer", path: "/bytes/123", method: "GET"},
{desc: "two levels", expectedRole: "maintainer", path: "/stamps/1/17", method: "POST"},
{desc: "topup", expectedRole: "maintainer", path: "/stamps/topup/d8e1c/100", method: "PATCH"},
{desc: "dilute", expectedRole: "maintainer", path: "/stamps/dilute/d8e1c/100", method: "PATCH"},
}
for _, tc := range tt {
t.Run(tc.desc, func(t *testing.T) {
Expand Down

0 comments on commit 02fc4ff

Please sign in to comment.