Plugins: Migrate licensing and access control to pkg/services/pluginsintegration package (#65258)
* migrate licensing + access control * update package name
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/navtree"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginaccesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
@@ -26,8 +27,8 @@ func TestAddAppLinks(t *testing.T) {
|
||||
httpReq, _ := http.NewRequest(http.MethodGet, "", nil)
|
||||
reqCtx := &contextmodel.ReqContext{SignedInUser: &user.SignedInUser{}, Context: &web.Context{Req: httpReq}}
|
||||
permissions := []ac.Permission{
|
||||
{Action: plugins.ActionAppAccess, Scope: "*"},
|
||||
{Action: plugins.ActionInstall, Scope: "*"},
|
||||
{Action: pluginaccesscontrol.ActionAppAccess, Scope: "*"},
|
||||
{Action: pluginaccesscontrol.ActionInstall, Scope: "*"},
|
||||
{Action: datasources.ActionCreate, Scope: "*"},
|
||||
{Action: datasources.ActionRead, Scope: "*"},
|
||||
}
|
||||
@@ -459,7 +460,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
|
||||
t.Run("Should add both includes when the user is an editor", func(t *testing.T) {
|
||||
treeRoot := navtree.NavTreeRoot{}
|
||||
user.Permissions = map[int64]map[string][]string{
|
||||
1: {plugins.ActionAppAccess: []string{"*"}},
|
||||
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
|
||||
}
|
||||
user.OrgRole = roletype.RoleEditor
|
||||
|
||||
@@ -474,7 +475,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
|
||||
t.Run("Should add one include when the user is a viewer", func(t *testing.T) {
|
||||
treeRoot := navtree.NavTreeRoot{}
|
||||
user.Permissions = map[int64]map[string][]string{
|
||||
1: {plugins.ActionAppAccess: []string{"*"}},
|
||||
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
|
||||
}
|
||||
user.OrgRole = roletype.RoleViewer
|
||||
|
||||
@@ -488,7 +489,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
|
||||
t.Run("Should add both includes when the user is a viewer with catalog read", func(t *testing.T) {
|
||||
treeRoot := navtree.NavTreeRoot{}
|
||||
user.Permissions = map[int64]map[string][]string{
|
||||
1: {plugins.ActionAppAccess: []string{"*"}, catalogReadAction: []string{}},
|
||||
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}, catalogReadAction: []string{}},
|
||||
}
|
||||
user.OrgRole = roletype.RoleViewer
|
||||
service.features = featuremgmt.WithFeatures(featuremgmt.FlagAccessControlOnCall)
|
||||
@@ -504,7 +505,7 @@ func TestAddAppLinksAccessControl(t *testing.T) {
|
||||
t.Run("Should add one include when the user is an editor without catalog read", func(t *testing.T) {
|
||||
treeRoot := navtree.NavTreeRoot{}
|
||||
user.Permissions = map[int64]map[string][]string{
|
||||
1: {plugins.ActionAppAccess: []string{"*"}},
|
||||
1: {pluginaccesscontrol.ActionAppAccess: []string{"*"}},
|
||||
}
|
||||
user.OrgRole = roletype.RoleEditor
|
||||
service.features = featuremgmt.WithFeatures(featuremgmt.FlagAccessControlOnCall)
|
||||
|
||||
Reference in New Issue
Block a user