mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 02:32:19 +08:00
Move SignedInUser to user service and RoleType and Roles to org (#53445)
* Move SignedInUser to user service and RoleType and Roles to org * Use go naming convention for roles * Fix some imports and leftovers * Fix ldap debug test * Fix lint * Fix lint 2 * Fix lint 3 * Fix type and not needed conversion * Clean up messages in api tests * Clean up api tests 2
This commit is contained in:
@ -8,10 +8,11 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/plugindashboards"
|
||||
"github.com/grafana/grafana/pkg/services/quota/quotatest"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/web/webtest"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -52,9 +53,9 @@ func TestGetPluginDashboards(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Signed in and not org admin should return 403 Forbidden", func(t *testing.T) {
|
||||
user := &models.SignedInUser{
|
||||
user := &user.SignedInUser{
|
||||
UserId: 1,
|
||||
OrgRole: models.ROLE_EDITOR,
|
||||
OrgRole: org.RoleEditor,
|
||||
}
|
||||
|
||||
resp, err := sendGetPluginDashboardsRequestForSignedInUser(t, s, existingPluginID, user)
|
||||
@ -64,10 +65,10 @@ func TestGetPluginDashboards(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Signed in and org admin", func(t *testing.T) {
|
||||
user := &models.SignedInUser{
|
||||
user := &user.SignedInUser{
|
||||
UserId: 1,
|
||||
OrgId: 1,
|
||||
OrgRole: models.ROLE_ADMIN,
|
||||
OrgRole: org.RoleAdmin,
|
||||
}
|
||||
|
||||
t.Run("When plugin doesn't exist should return 404 Not Found", func(t *testing.T) {
|
||||
@ -101,7 +102,7 @@ func TestGetPluginDashboards(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func sendGetPluginDashboardsRequestForSignedInUser(t *testing.T, s *webtest.Server, pluginID string, user *models.SignedInUser) (*http.Response, error) {
|
||||
func sendGetPluginDashboardsRequestForSignedInUser(t *testing.T, s *webtest.Server, pluginID string, user *user.SignedInUser) (*http.Response, error) {
|
||||
t.Helper()
|
||||
|
||||
req := s.NewGetRequest(fmt.Sprintf("/api/plugins/%s/dashboards", pluginID))
|
||||
|
Reference in New Issue
Block a user