(c *gin.Context)
| 30 | } |
| 31 | |
| 32 | func CreateUser(c *gin.Context) { |
| 33 | var req model.User |
| 34 | if err := c.ShouldBind(&req); err != nil { |
| 35 | common.ErrorResp(c, err, 400) |
| 36 | return |
| 37 | } |
| 38 | if req.IsAdmin() || req.IsGuest() { |
| 39 | common.ErrorStrResp(c, "admin or guest user can not be created", 400, true) |
| 40 | return |
| 41 | } |
| 42 | req.SetPassword(req.Password) |
| 43 | req.Password = "" |
| 44 | req.Authn = "[]" |
| 45 | if err := op.CreateUser(&req); err != nil { |
| 46 | common.ErrorResp(c, err, 500, true) |
| 47 | } else { |
| 48 | common.SuccessResp(c) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func UpdateUser(c *gin.Context) { |
| 53 | var req model.User |
nothing calls this directly
no test coverage detected