From c397f131f55c82c571e9e10ccf47e70a8019d424 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 31 Jan 2023 16:00:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/api/v1/tech/tech.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/routers/api/v1/tech/tech.go b/routers/api/v1/tech/tech.go index 37a795c21..e62b0dd19 100644 --- a/routers/api/v1/tech/tech.go +++ b/routers/api/v1/tech/tech.go @@ -254,13 +254,7 @@ func FindTech(ctx *context.APIContext) { } func IsAdmin(ctx *context.APIContext) { - userName := ctx.Query("user") - user, err := models.GetUserByName(userName) - if err != nil { - ctx.JSON(http.StatusOK, response.OuterServerError("User not exists")) - return - } - isAdmin := role.UserHasRole(user.ID, models.TechProgramAdmin) + isAdmin := role.UserHasRole(ctx.User.ID, models.TechProgramAdmin) r := map[string]interface{}{} r["is_admin"] = isAdmin ctx.JSON(http.StatusOK, response.OuterSuccessWithData(r))