diff --git a/pkg/services/accesscontrol/middleware.go b/pkg/services/accesscontrol/middleware.go index 520c68c5e65..e93a0ca5e82 100644 --- a/pkg/services/accesscontrol/middleware.go +++ b/pkg/services/accesscontrol/middleware.go @@ -242,22 +242,6 @@ func UseGlobalOrg(c *contextmodel.ReqContext) (int64, error) { return GlobalOrgID, nil } -func LoadPermissionsMiddleware(service Service) web.Handler { - return func(c *contextmodel.ReqContext) { - permissions, err := service.GetUserPermissions(c.Req.Context(), c.SignedInUser, - Options{ReloadCache: false}) - if err != nil { - c.JsonApiErr(http.StatusForbidden, "", err) - return - } - - if c.SignedInUser.Permissions == nil { - c.SignedInUser.Permissions = make(map[int64]map[string][]string) - } - c.SignedInUser.Permissions[c.OrgID] = GroupScopesByAction(permissions) - } -} - // scopeParams holds the parameters used to fill in scope templates type scopeParams struct { OrgID int64 diff --git a/pkg/services/publicdashboards/api/common_test.go b/pkg/services/publicdashboards/api/common_test.go index eed91255020..0252b43e63f 100644 --- a/pkg/services/publicdashboards/api/common_test.go +++ b/pkg/services/publicdashboards/api/common_test.go @@ -17,9 +17,7 @@ import ( "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/plugins" pluginFakes "github.com/grafana/grafana/pkg/plugins/manager/fakes" - "github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol/acimpl" - "github.com/grafana/grafana/pkg/services/accesscontrol/actest" "github.com/grafana/grafana/pkg/services/contexthandler/ctxkey" contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model" "github.com/grafana/grafana/pkg/services/datasources" @@ -47,19 +45,6 @@ func setupTestServer( // build router to register routes rr := routing.NewRouteRegister() - var permissions []accesscontrol.Permission - if user != nil && user.Permissions != nil { - for action, scopes := range user.Permissions[user.OrgID] { - for _, scope := range scopes { - permissions = append(permissions, accesscontrol.Permission{ - Action: action, - Scope: scope, - }) - } - } - } - - acService := actest.FakeService{ExpectedPermissions: permissions, ExpectedDisabled: !cfg.RBACEnabled} ac := acimpl.ProvideAccessControl(cfg) // build mux @@ -67,7 +52,6 @@ func setupTestServer( // set initial context m.Use(contextProvider(&testContext{user})) - m.Use(accesscontrol.LoadPermissionsMiddleware(acService)) // build api, this will mount the routes at the same time if // featuremgmt.FlagPublicDashboard is enabled