diff --git a/http/router.go b/http/router.go index a873be93..4994b5c5 100644 --- a/http/router.go +++ b/http/router.go @@ -206,7 +206,7 @@ func configRoutes(r *gin.Engine) { v1.GET("/can-do-op-by-name", login(), canDoOpByName) v1.GET("/can-do-op-by-token", login(), canDoOpByToken) - + v1.GET("/get-user-by-name", login(), getUserByName) } push := r.Group("/v1/n9e/series").Use(gzip.Gzip(gzip.DefaultCompression)) diff --git a/http/router_auth.go b/http/router_auth.go index 90a39496..7688a6da 100644 --- a/http/router_auth.go +++ b/http/router_auth.go @@ -90,3 +90,8 @@ func canDoOpByToken(c *gin.Context) { can, err := user.CanDo(queryStr(c, "op")) renderData(c, can, err) } + +func getUserByName(c *gin.Context) { + user, err := models.UserGetByUsername(queryStr(c, "name")) + renderData(c, user, err) +}