mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 12:22:15 +08:00
RBAC: Cover plugin routes (#80578)
* RBAC: Cover plugin routes * Action instead of ReqAction * Fix test initializations * Fix NewPluginProxy call * Duplicate test to add RBAC checks * Cover legacy access control as well * Fix typo * action -> reqAction * Add example Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com> --------- Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
This commit is contained in:
@ -194,6 +194,7 @@ type Route struct {
|
||||
Path string `json:"path"`
|
||||
Method string `json:"method"`
|
||||
ReqRole org.RoleType `json:"reqRole"`
|
||||
ReqAction string `json:"reqAction"`
|
||||
URL string `json:"url"`
|
||||
URLParams []URLParam `json:"urlParams"`
|
||||
Headers []Header `json:"headers"`
|
||||
@ -203,6 +204,10 @@ type Route struct {
|
||||
Body json.RawMessage `json:"body"`
|
||||
}
|
||||
|
||||
func (r *Route) RequiresRBACAction() bool {
|
||||
return r.ReqAction != ""
|
||||
}
|
||||
|
||||
// Header describes an HTTP header that is forwarded with
|
||||
// the proxied request for a plugin route
|
||||
type Header struct {
|
||||
|
Reference in New Issue
Block a user