LBAC for datasources: GA (#99511)

* GA: feature toggle removal of `teamHttpHeaders`

* Apply suggestions from code review

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

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Eric Leijonmarck
2025-02-20 10:26:46 +00:00
committed by GitHub
parent 6dae264a06
commit 32643c933e
12 changed files with 18 additions and 32 deletions
@@ -572,7 +572,7 @@ func TestService_UpdateDataSource(t *testing.T) {
t.Run("Should update LBAC rules when updating from API", func(t *testing.T) {
dsService := initDSService(t)
dsService.features = featuremgmt.WithFeatures(featuremgmt.FlagTeamHttpHeaders)
dsService.features = featuremgmt.WithFeatures()
// Create a datasource with existing LBAC rules
existingRules := []interface{}{
@@ -629,7 +629,7 @@ func TestService_UpdateDataSource(t *testing.T) {
})
t.Run("Should preserve LBAC rules when not updating from API", func(t *testing.T) {
dsService := initDSService(t)
dsService.features = featuremgmt.WithFeatures(featuremgmt.FlagTeamHttpHeaders)
dsService.features = featuremgmt.WithFeatures()
// Create a datasource with existing LBAC rules
existingRules := []interface{}{
map[string]interface{}{
@@ -680,7 +680,7 @@ func TestService_UpdateDataSource(t *testing.T) {
t.Run("Should not remove stored rules without AllowLBACRuleUpdates", func(t *testing.T) {
dsService := initDSService(t)
dsService.features = featuremgmt.WithFeatures(featuremgmt.FlagTeamHttpHeaders)
dsService.features = featuremgmt.WithFeatures()
// Create a datasource with existing LBAC rules
existingRules := []interface{}{
@@ -720,7 +720,7 @@ func TestService_UpdateDataSource(t *testing.T) {
t.Run("Should not populate empty stored rules without AllowLBACRuleUpdates", func(t *testing.T) {
dsService := initDSService(t)
dsService.features = featuremgmt.WithFeatures(featuremgmt.FlagTeamHttpHeaders)
dsService.features = featuremgmt.WithFeatures()
// Create a datasource with empty LBAC rules
jsonData := simplejson.New()