Live: array for Processor, Outputter and Subscriber in channel rule top level (#39677)

This commit is contained in:
Alexander Emelin
2021-10-06 20:43:25 +03:00
committed by GitHub
parent ed0c43b106
commit 5358c45a3a
46 changed files with 1278 additions and 718 deletions
+23
View File
@@ -0,0 +1,23 @@
package pipeline
import (
"context"
"github.com/grafana/grafana/pkg/models"
)
type RoleCheckAuthorizer struct {
role models.RoleType
}
func NewRoleCheckAuthorizer(role models.RoleType) *RoleCheckAuthorizer {
return &RoleCheckAuthorizer{role: role}
}
func (s *RoleCheckAuthorizer) CanSubscribe(_ context.Context, u *models.SignedInUser) (bool, error) {
return u.HasRole(s.role), nil
}
func (s *RoleCheckAuthorizer) CanPublish(_ context.Context, u *models.SignedInUser) (bool, error) {
return u.HasRole(s.role), nil
}