From 02fc4ff09aedbebd19eca57a882c8b08141216ec Mon Sep 17 00:00:00 2001 From: Anatol <87016465+notanatol@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:20:27 +0200 Subject: [PATCH] fix(auth): topup and stewardship roles (#213) --- pkg/bee/api/auth.go | 3 +++ pkg/bee/api/auth_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/pkg/bee/api/auth.go b/pkg/bee/api/auth.go index 4b1167833..b30cd3637 100644 --- a/pkg/bee/api/auth.go +++ b/pkg/bee/api/auth.go @@ -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"}, @@ -163,5 +165,6 @@ var policies = [][]string{ {"consumer", "/consumed", "GET"}, {"consumer", "/consumed/*", "GET"}, {"consumer", "/chunks/stream", "GET"}, + {"creator", "/stewardship/*", "GET"}, {"consumer", "/stewardship/*", "PUT"}, } diff --git a/pkg/bee/api/auth_test.go b/pkg/bee/api/auth_test.go index f5d4f7d94..95f92a499 100644 --- a/pkg/bee/api/auth_test.go +++ b/pkg/bee/api/auth_test.go @@ -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) {