mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 23:52:19 +08:00

* seperate services for env + req * merge with main * fix tests * undo changes to golden file * fix linter * remove unused fields * split out new config struct * provide config * undo go mod changes * more renaming * fix tests * undo bra.toml changes * update go.work.sum * undo changes * trigger * apply PR feedback
39 lines
755 B
Go
39 lines
755 B
Go
package signature
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
"github.com/grafana/grafana/pkg/plugins/config"
|
|
)
|
|
|
|
func ProvideOSSAuthorizer(cfg *config.PluginManagementCfg) *UnsignedPluginAuthorizer {
|
|
return NewUnsignedAuthorizer(cfg)
|
|
}
|
|
|
|
func NewUnsignedAuthorizer(cfg *config.PluginManagementCfg) *UnsignedPluginAuthorizer {
|
|
return &UnsignedPluginAuthorizer{
|
|
cfg: cfg,
|
|
}
|
|
}
|
|
|
|
type UnsignedPluginAuthorizer struct {
|
|
cfg *config.PluginManagementCfg
|
|
}
|
|
|
|
func (u *UnsignedPluginAuthorizer) CanLoadPlugin(p *plugins.Plugin) bool {
|
|
if p.Signature != plugins.SignatureStatusUnsigned {
|
|
return true
|
|
}
|
|
|
|
if u.cfg.DevMode {
|
|
return true
|
|
}
|
|
|
|
for _, pID := range u.cfg.PluginsAllowUnsigned {
|
|
if pID == p.ID {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|