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:
idafurjes
2022-08-10 11:56:48 +02:00
committed by GitHub
parent 46004037e2
commit 6afad51761
278 changed files with 1758 additions and 1543 deletions
+10 -9
View File
@@ -4,7 +4,8 @@ import (
"errors"
"time"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
)
var (
@@ -19,7 +20,7 @@ type APIKey struct {
OrgId int64
Name string
Key string
Role models.RoleType
Role org.RoleType
Created time.Time
Updated time.Time
LastUsedAt *time.Time `xorm:"last_used_at"`
@@ -31,12 +32,12 @@ func (k APIKey) TableName() string { return "api_key" }
// swagger:model
type AddCommand struct {
Name string `json:"name" binding:"Required"`
Role models.RoleType `json:"role" binding:"Required"`
OrgId int64 `json:"-"`
Key string `json:"-"`
SecondsToLive int64 `json:"secondsToLive"`
Result *APIKey `json:"-"`
Name string `json:"name" binding:"Required"`
Role org.RoleType `json:"role" binding:"Required"`
OrgId int64 `json:"-"`
Key string `json:"-"`
SecondsToLive int64 `json:"secondsToLive"`
Result *APIKey `json:"-"`
}
type DeleteCommand struct {
@@ -47,7 +48,7 @@ type DeleteCommand struct {
type GetApiKeysQuery struct {
OrgId int64
IncludeExpired bool
User *models.SignedInUser
User *user.SignedInUser
Result []*APIKey
}
type GetByNameQuery struct {