fix(webui): channel reload route is authorized as the channel action
Issue: archie-core-4laa1
This commit is contained in:
1 parent
b9547b01a8
commit
8e6dfd785f
2 files changed
+9
-1
No files matched your search
@@ -295,7 +295,7 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res
|
||||
return access.ActionUpdate, access.KindSecret, "", true
|
||||
case matchPrefix(path, "/api/harness/bindings"):
|
||||
return access.ActionRead, access.KindSecret, "", true
|
||||
case matchPrefix(path, "/api/channels/"):
|
||||
case matchPrefix(path, "/api/channels"):
|
||||
return actionManage(action), access.KindDashboard, segmentValue(path, 2), true
|
||||
case matchPrefix(path, "/api/config"), matchPrefix(path, "/api/logs"),
|
||||
// A person's own tokens act only as that person, so managing them
|
||||
|
||||
@@ -209,6 +209,14 @@ func TestAdministrationRoutes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestChannelReloadRoute(t *testing.T) {
|
||||
req := httptest.NewRequestWithContext(t.Context(), http.MethodPost, "/api/channels/telegram/reload", nil)
|
||||
action, kind, key := accessRequest(req)
|
||||
if action != access.ActionManageIdentities || kind != access.KindDashboard || key != "telegram" {
|
||||
t.Fatalf("accessRequest = %q on %q (%q), want %q on %q (telegram)", action, kind, key, access.ActionManageIdentities, access.KindDashboard)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPersonalTokensWithoutPerson(t *testing.T) {
|
||||
for _, method := range []string{http.MethodGet, http.MethodPost, http.MethodDelete} {
|
||||
t.Run(method, func(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user