Chore: Move ReqContext to contexthandler service (#62102)
* Chore: Move ReqContext to contexthandler service * Rename package to contextmodel * Generate ngalert files * Remove unused imports
This commit is contained in:
@@ -5,14 +5,14 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/login"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
SearchUsers(c *models.ReqContext) response.Response
|
||||
SearchUsersWithPaging(c *models.ReqContext) response.Response
|
||||
SearchUsers(c *contextmodel.ReqContext) response.Response
|
||||
SearchUsersWithPaging(c *contextmodel.ReqContext) response.Response
|
||||
}
|
||||
|
||||
type OSSService struct {
|
||||
@@ -39,7 +39,7 @@ func ProvideUsersService(searchUserFilter user.SearchUserFilter, userService use
|
||||
// 401: unauthorisedError
|
||||
// 403: forbiddenError
|
||||
// 500: internalServerError
|
||||
func (s *OSSService) SearchUsers(c *models.ReqContext) response.Response {
|
||||
func (s *OSSService) SearchUsers(c *contextmodel.ReqContext) response.Response {
|
||||
result, err := s.SearchUser(c)
|
||||
if err != nil {
|
||||
return response.Error(500, "Failed to fetch users", err)
|
||||
@@ -58,7 +58,7 @@ func (s *OSSService) SearchUsers(c *models.ReqContext) response.Response {
|
||||
// 403: forbiddenError
|
||||
// 404: notFoundError
|
||||
// 500: internalServerError
|
||||
func (s *OSSService) SearchUsersWithPaging(c *models.ReqContext) response.Response {
|
||||
func (s *OSSService) SearchUsersWithPaging(c *contextmodel.ReqContext) response.Response {
|
||||
result, err := s.SearchUser(c)
|
||||
if err != nil {
|
||||
return response.Error(500, "Failed to fetch users", err)
|
||||
@@ -67,7 +67,7 @@ func (s *OSSService) SearchUsersWithPaging(c *models.ReqContext) response.Respon
|
||||
return response.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
func (s *OSSService) SearchUser(c *models.ReqContext) (*user.SearchUserQueryResult, error) {
|
||||
func (s *OSSService) SearchUser(c *contextmodel.ReqContext) (*user.SearchUserQueryResult, error) {
|
||||
perPage := c.QueryInt("perpage")
|
||||
if perPage <= 0 {
|
||||
perPage = 1000
|
||||
|
||||
Reference in New Issue
Block a user