Chore: Move identity and errutil to apimachinery module (#89116)

This commit is contained in:
Ryan McKinley
2024-06-13 07:11:35 +03:00
committed by GitHub
parent 12a45fdeca
commit 99d8025829
298 changed files with 575 additions and 393 deletions
@@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/apimachinery/identity"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models/roletype"
"github.com/grafana/grafana/pkg/plugins"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
@@ -411,7 +411,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
Type: "page",
AddToNav: true,
DefaultNav: true,
Role: roletype.RoleEditor,
Role: identity.RoleEditor,
Action: catalogReadAction,
},
{
@@ -419,7 +419,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
Path: "/a/test-app1/page2",
Type: "page",
AddToNav: true,
Role: roletype.RoleViewer,
Role: identity.RoleViewer,
},
},
},
@@ -445,7 +445,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
t.Run("Should not add app links when the user cannot access app plugins", func(t *testing.T) {
treeRoot := navtree.NavTreeRoot{}
user.Permissions = map[int64]map[string][]string{}
user.OrgRole = roletype.RoleAdmin
user.OrgRole = identity.RoleAdmin
err := service.addAppLinks(&treeRoot, reqCtx)
require.NoError(t, err)
@@ -456,7 +456,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
user.Permissions = map[int64]map[string][]string{
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
}
user.OrgRole = roletype.RoleEditor
user.OrgRole = identity.RoleEditor
err := service.addAppLinks(&treeRoot, reqCtx)
require.NoError(t, err)
@@ -472,7 +472,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
user.Permissions = map[int64]map[string][]string{
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
}
user.OrgRole = roletype.RoleViewer
user.OrgRole = identity.RoleViewer
err := service.addAppLinks(&treeRoot, reqCtx)
require.NoError(t, err)
@@ -487,7 +487,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
user.Permissions = map[int64]map[string][]string{
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}, catalogReadAction: []string{}},
}
user.OrgRole = roletype.RoleViewer
user.OrgRole = identity.RoleViewer
service.features = featuremgmt.WithFeatures(featuremgmt.FlagAccessControlOnCall)
err := service.addAppLinks(&treeRoot, reqCtx)
@@ -504,7 +504,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
user.Permissions = map[int64]map[string][]string{
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
}
user.OrgRole = roletype.RoleEditor
user.OrgRole = identity.RoleEditor
service.features = featuremgmt.WithFeatures(featuremgmt.FlagAccessControlOnCall)
err := service.addAppLinks(&treeRoot, reqCtx)
+1 -1
View File
@@ -4,11 +4,11 @@ import (
"sort"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/apimachinery/identity"
"github.com/grafana/grafana/pkg/infra/kvstore"
"github.com/grafana/grafana/pkg/infra/log"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/apikey"
"github.com/grafana/grafana/pkg/services/auth/identity"
"github.com/grafana/grafana/pkg/services/authn"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/dashboards"