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:
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
@@ -47,7 +47,7 @@ func (api *AccessControlAPI) RegisterAPIEndpoints() {
|
||||
}
|
||||
|
||||
// GET /api/access-control/user/actions
|
||||
func (api *AccessControlAPI) getUserActions(c *models.ReqContext) response.Response {
|
||||
func (api *AccessControlAPI) getUserActions(c *contextmodel.ReqContext) response.Response {
|
||||
reloadCache := c.QueryBool("reloadcache")
|
||||
permissions, err := api.Service.GetUserPermissions(c.Req.Context(),
|
||||
c.SignedInUser, ac.Options{ReloadCache: reloadCache})
|
||||
@@ -59,7 +59,7 @@ func (api *AccessControlAPI) getUserActions(c *models.ReqContext) response.Respo
|
||||
}
|
||||
|
||||
// GET /api/access-control/user/permissions
|
||||
func (api *AccessControlAPI) getUserPermissions(c *models.ReqContext) response.Response {
|
||||
func (api *AccessControlAPI) getUserPermissions(c *contextmodel.ReqContext) response.Response {
|
||||
reloadCache := c.QueryBool("reloadcache")
|
||||
permissions, err := api.Service.GetUserPermissions(c.Req.Context(),
|
||||
c.SignedInUser, ac.Options{ReloadCache: reloadCache})
|
||||
@@ -71,7 +71,7 @@ func (api *AccessControlAPI) getUserPermissions(c *models.ReqContext) response.R
|
||||
}
|
||||
|
||||
// GET /api/access-control/users/permissions
|
||||
func (api *AccessControlAPI) searchUsersPermissions(c *models.ReqContext) response.Response {
|
||||
func (api *AccessControlAPI) searchUsersPermissions(c *contextmodel.ReqContext) response.Response {
|
||||
searchOptions := ac.SearchOptions{
|
||||
ActionPrefix: c.Query("actionPrefix"),
|
||||
Action: c.Query("action"),
|
||||
@@ -98,7 +98,7 @@ func (api *AccessControlAPI) searchUsersPermissions(c *models.ReqContext) respon
|
||||
}
|
||||
|
||||
// GET /api/access-control/user/:userID/permissions/search
|
||||
func (api *AccessControlAPI) searchUserPermissions(c *models.ReqContext) response.Response {
|
||||
func (api *AccessControlAPI) searchUserPermissions(c *contextmodel.ReqContext) response.Response {
|
||||
userIDString := web.Params(c.Req)[":userID"]
|
||||
userID, err := strconv.ParseInt(userIDString, 10, 64)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user