RBAC: Annotation permission migration (#78899)

* add annotation permissions to dashboard managed role and add migrations for annotation permissions

* fix a bug with conditional access level definitions

* add tests

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

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

* apply feedback

* add batching, fix tests and a typo

* add one more test

* undo unneeded change

* undo unwanted change

* only check the default basic permissions for non-OSS instances

* account for all wildcards and simplify the check a bit

* error handling and extra conditionals to avoid test failures

* fix a bug with admin permissions not appearing for folders

* fix the OSS check

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
Ieva
2024-01-26 17:17:29 +00:00
committed by GitHub
parent 138079bbd8
commit 048d1e7c86
7 changed files with 547 additions and 12 deletions
@@ -114,6 +114,15 @@ func (*OSSMigrations) AddMigration(mg *Migrator) {
ualert.CreateOrgMigratedKVStoreEntries(mg)
// https://github.com/grafana/identity-access-team/issues/546: tracks removal of the feature toggle from the annotation permission migration
// nolint:staticcheck
if mg.Cfg != nil && mg.Cfg.IsFeatureToggleEnabled != nil {
// nolint:staticcheck
if mg.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagAnnotationPermissionUpdate) {
accesscontrol.AddManagedDashboardAnnotationActionsMigration(mg)
}
}
addKVStoreMySQLValueTypeLongTextMigration(mg)
}