diff --git a/pkg/api/accesscontrol.go b/pkg/api/accesscontrol.go index 9dd4949f01e..0c2a5748f84 100644 --- a/pkg/api/accesscontrol.go +++ b/pkg/api/accesscontrol.go @@ -182,7 +182,7 @@ func (hs *HTTPServer) declareFixedRoles() error { }, }, }, - Grants: []string{"Admin"}, + Grants: []string{string(models.ROLE_ADMIN)}, } orgReaderRole := ac.RoleRegistration{ diff --git a/pkg/services/sqlstore/migrations/apikey_mig.go b/pkg/services/sqlstore/migrations/apikey_mig.go index f68bae4c7ac..5e33b0e941d 100644 --- a/pkg/services/sqlstore/migrations/apikey_mig.go +++ b/pkg/services/sqlstore/migrations/apikey_mig.go @@ -1,6 +1,8 @@ package migrations -import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" +import ( + . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" +) func addApiKeyMigrations(mg *Migrator) { apiKeyV1 := Table{ @@ -86,4 +88,7 @@ func addApiKeyMigrations(mg *Migrator) { mg.AddMigration("Add service account foreign key", NewAddColumnMigration(apiKeyV2, &Column{ Name: "service_account_id", Type: DB_BigInt, Nullable: true, })) + + mg.AddMigration("set service account foreign key to nil if 0", NewRawSQLMigration( + "UPDATE api_key SET service_account_id = NULL WHERE service_account_id = 0;")) }