@ -14,6 +14,7 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/featuremgmt"
@ -22,6 +23,7 @@ import (
"github.com/grafana/grafana/pkg/services/org/orgtest"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
"github.com/grafana/grafana/pkg/services/team/teamimpl"
"github.com/grafana/grafana/pkg/services/temp_user/tempuserimpl"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/services/user/userimpl"
@ -388,7 +390,7 @@ func TestGetOrgUsersAPIEndpoint_AccessControlMetadata(t *testing.T) {
cfg . RBACEnabled = tc . enableAccessControl
sc := setupHTTPServerWithCfg ( t , false , cfg , func ( hs * HTTPServer ) {
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , cfg ) , localcache . ProvideService ( ) ,
)
hs . orgService = orgimpl . ProvideService ( hs . SQLStore , cfg )
} )
@ -471,7 +473,7 @@ func TestGetOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
targetOrg : 2 ,
} ,
{
name : "org admin can get users in his org" ,
name : "org admin can get users in their org" ,
enableAccessControl : true ,
expectedCode : http . StatusOK ,
expectedUserCount : 2 ,
@ -492,7 +494,7 @@ func TestGetOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
cfg . RBACEnabled = tc . enableAccessControl
sc := setupHTTPServerWithCfg ( t , false , cfg , func ( hs * HTTPServer ) {
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , cfg ) , localcache . ProvideService ( ) ,
)
hs . orgService = orgimpl . ProvideService ( hs . SQLStore , cfg )
} )
@ -597,7 +599,7 @@ func TestPostOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
cfg . RBACEnabled = tc . enableAccessControl
sc := setupHTTPServerWithCfg ( t , false , cfg , func ( hs * HTTPServer ) {
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , cfg ) , localcache . ProvideService ( ) ,
)
} )
@ -716,7 +718,7 @@ func TestOrgUsersAPIEndpointWithSetPerms_AccessControl(t *testing.T) {
sc := setupHTTPServer ( t , true , func ( hs * HTTPServer ) {
hs . tempUserService = tempuserimpl . ProvideService ( hs . SQLStore )
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , setting . NewCfg ( ) , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , setting . NewCfg ( ) , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , setting . NewCfg ( ) ) , localcache . ProvideService ( ) ,
)
} )
setInitCtxSignedInViewer ( sc . initCtx )
@ -834,7 +836,7 @@ func TestPatchOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
cfg . RBACEnabled = tc . enableAccessControl
sc := setupHTTPServerWithCfg ( t , false , cfg , func ( hs * HTTPServer ) {
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , cfg ) , localcache . ProvideService ( ) ,
)
hs . orgService = orgimpl . ProvideService ( hs . SQLStore , cfg )
} )
@ -961,7 +963,7 @@ func TestDeleteOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
cfg . RBACEnabled = tc . enableAccessControl
sc := setupHTTPServerWithCfg ( t , false , cfg , func ( hs * HTTPServer ) {
hs . userService = userimpl . ProvideService (
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) ,
hs . SQLStore , nil , cfg , hs . SQLStore . ( * sqlstore . SQLStore ) , teamimpl . ProvideService ( hs . SQLStore . ( * sqlstore . SQLStore ) , cfg ) , localcache . ProvideService ( ) ,
)
hs . orgService = orgimpl . ProvideService ( hs . SQLStore , cfg )
} )