2023-08-21 14:26:49 +01:00
|
|
|
package guardian
|
|
|
|
|
|
|
|
|
|
import (
|
2023-08-30 16:51:18 +02:00
|
|
|
"github.com/grafana/grafana/pkg/services/auth/identity"
|
2023-08-21 14:26:49 +01:00
|
|
|
"github.com/grafana/grafana/pkg/services/datasources"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DatasourceGuardianProvider interface {
|
2023-08-30 16:51:18 +02:00
|
|
|
New(orgID int64, user identity.Requester, dataSources ...datasources.DataSource) DatasourceGuardian
|
2023-08-21 14:26:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DatasourceGuardian interface {
|
|
|
|
|
CanQuery(datasourceID int64) (bool, error)
|
|
|
|
|
FilterDatasourcesByQueryPermissions([]*datasources.DataSource) ([]*datasources.DataSource, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ProvideGuardian() *OSSProvider {
|
|
|
|
|
return &OSSProvider{}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type OSSProvider struct{}
|
|
|
|
|
|
2023-08-30 16:51:18 +02:00
|
|
|
func (p *OSSProvider) New(orgID int64, user identity.Requester, dataSources ...datasources.DataSource) DatasourceGuardian {
|
2023-08-21 14:26:49 +01:00
|
|
|
return &AllowGuardian{}
|
|
|
|
|
}
|