NM-57: Graphs API Forbidden for Platform User (#3577)

* fix(go): permissions for network graph;

* fix(go): allow platform user to get network graph;

* feat(go): allow read only access to host resource to network users.

* feat(go): remove specific check for hosts resource.
This commit is contained in:
Vishal Dalwadi
2025-08-08 22:14:42 +05:30
committed by GitHub
parent e0e0a76563
commit 996410fc61
7 changed files with 80 additions and 32 deletions

View File

@@ -60,6 +60,11 @@ func userMiddleWare(handler http.Handler) http.Handler {
if strings.Contains(route, "networks") {
r.Header.Set("TARGET_RSRC", models.NetworkRsrc.String())
}
// check 'graph' after 'networks', otherwise the
// header will be overwritten.
if strings.Contains(route, "graph") {
r.Header.Set("TARGET_RSRC", models.HostRsrc.String())
}
if strings.Contains(route, "acls") {
r.Header.Set("TARGET_RSRC", models.AclRsrc.String())
}