mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 04:34:23 -06:00
1fdd3767f1
* AccessControl: Protect usage report preview endpoint * Fix role display name * Change action name * Fix imports
31 lines
692 B
Go
31 lines
692 B
Go
package service
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
)
|
|
|
|
const (
|
|
ActionRead = "server.usagestats.report:read"
|
|
)
|
|
|
|
var (
|
|
usagestatsReaderRole = accesscontrol.RoleDTO{
|
|
Name: "fixed:usagestats:reader",
|
|
DisplayName: "Usage stats report reader",
|
|
Description: "View usage statistics report",
|
|
Group: "Statistics",
|
|
Permissions: []accesscontrol.Permission{
|
|
{Action: ActionRead},
|
|
},
|
|
}
|
|
)
|
|
|
|
func declareFixedRoles(ac accesscontrol.Service) error {
|
|
usagestatsReader := accesscontrol.RoleRegistration{
|
|
Role: usagestatsReaderRole,
|
|
Grants: []string{string(accesscontrol.RoleGrafanaAdmin)},
|
|
}
|
|
|
|
return ac.DeclareFixedRoles(usagestatsReader)
|
|
}
|