mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 17:02:20 +08:00

* replace xorm.io/xorm imports * replace xorm from other go.mod files * clean up workspace * nolint does not make sense anymore as it is not a module * try if nolint directive helps * use nolint:all for xorm * add more nolints * try to skip xorm in linter config * exclude xorm differently * retrigger ci
34 lines
1021 B
Go
34 lines
1021 B
Go
package accesscontrol
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/util/xorm"
|
|
|
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
)
|
|
|
|
const (
|
|
AlertingScopeRemovalMigrationID = "removing scope from alert.instances:read action migration"
|
|
)
|
|
|
|
func AddAlertingScopeRemovalMigration(mg *migrator.Migrator) {
|
|
mg.AddMigration(AlertingScopeRemovalMigrationID, &alertingScopeRemovalMigrator{})
|
|
}
|
|
|
|
var _ migrator.CodeMigration = new(alertingScopeRemovalMigrator)
|
|
|
|
type alertingScopeRemovalMigrator struct {
|
|
permissionMigrator
|
|
}
|
|
|
|
func (p *alertingScopeRemovalMigrator) SQL(dialect migrator.Dialect) string {
|
|
return CodeMigrationSQL
|
|
}
|
|
|
|
func (p *alertingScopeRemovalMigrator) Exec(sess *xorm.Session, migrator *migrator.Migrator) error {
|
|
p.sess = sess
|
|
p.dialect = migrator.Dialect
|
|
_, err := p.sess.Exec("UPDATE permission SET `scope` = '', `kind` = '', `attribute` = '', `identifier` = '' WHERE action = ?", accesscontrol.ActionAlertingInstanceRead)
|
|
return err
|
|
}
|