AccessControl: Add migration for seeding managed inherited permissions (#49337)

* AccessControl: Add migration for seeding managed inherited permissions

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

* AccessControl: move to single file

* AccessControl: Add tests for managed permission migration

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* AccessControl: Ensure no duplicate insertion

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Remove commented code

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Add code migration constant

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Ensure DB is clean between tests

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Update pkg/services/sqlstore/migrations/accesscontrol/managed_permission_migrator.go

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
Jguer
2022-05-23 16:50:10 +02:00
committed by GitHub
co-authored by Karl Persson Gabriel MABILLE
parent 18727f0bf5
commit 3250bf6b2b
5 changed files with 384 additions and 4 deletions
@@ -1,6 +1,10 @@
package accesscontrol
import "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
import (
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
)
const CodeMigrationSQL = "code migration"
func AddMigration(mg *migrator.Migrator) {
permissionV1 := migrator.Table{