2022-07-08 06:24:09 -05:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import (
|
|
|
|
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
2022-08-10 04:56:48 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/org"
|
2022-07-08 06:24:09 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ActionAppAccess = "plugins.app:access"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ScopeProvider = ac.NewScopeProvider("plugins")
|
|
|
|
)
|
|
|
|
|
2022-08-26 02:59:34 -05:00
|
|
|
func DeclareRBACRoles(service ac.Service) error {
|
2022-07-08 06:24:09 -05:00
|
|
|
AppPluginsReader := ac.RoleRegistration{
|
|
|
|
Role: ac.RoleDTO{
|
|
|
|
Name: ac.FixedRolePrefix + "plugins.app:reader",
|
|
|
|
DisplayName: "Application Plugins Access",
|
|
|
|
Description: "Access application plugins (still enforcing the organization role)",
|
|
|
|
Group: "Plugins",
|
|
|
|
Permissions: []ac.Permission{
|
|
|
|
{Action: ActionAppAccess, Scope: ScopeProvider.GetResourceAllScope()},
|
|
|
|
},
|
|
|
|
},
|
2022-08-10 04:56:48 -05:00
|
|
|
Grants: []string{string(org.RoleViewer)},
|
2022-07-08 06:24:09 -05:00
|
|
|
}
|
2022-08-26 02:59:34 -05:00
|
|
|
return service.DeclareFixedRoles(AppPluginsReader)
|
2022-07-08 06:24:09 -05:00
|
|
|
}
|