RBAC: Refactor RBAC plugin interface code (#90679)
move plugin RBAC registration ifaces to pluginsintegrations
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package pluginaccesscontrol
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
@@ -23,6 +26,16 @@ var (
|
||||
AdminAccessEvaluator = ac.EvalAny(ac.EvalPermission(ActionWrite), ac.EvalPermission(ActionInstall))
|
||||
)
|
||||
|
||||
// RoleRegistry handles the plugin RBAC roles and their assignments
|
||||
type RoleRegistry interface {
|
||||
DeclarePluginRoles(ctx context.Context, ID, name string, registrations []plugins.RoleRegistration) error
|
||||
}
|
||||
|
||||
// ActionSetRegistry handles the plugin RBAC actionsets
|
||||
type ActionSetRegistry interface {
|
||||
RegisterActionSets(ctx context.Context, ID string, registrations []plugins.ActionSet) error
|
||||
}
|
||||
|
||||
func ReqCanAdminPlugins(cfg *setting.Cfg) func(rc *contextmodel.ReqContext) bool {
|
||||
// Legacy handler that protects access to the Configuration > Plugins page
|
||||
return func(rc *contextmodel.ReqContext) bool {
|
||||
|
||||
Reference in New Issue
Block a user