MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / CreateUser

Function CreateUser

server/handles/user.go:32–50  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

30}
31
32func 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
52func UpdateUser(c *gin.Context) {
53 var req model.User

Callers

nothing calls this directly

Calls 7

IsAdminMethod · 0.95
IsGuestMethod · 0.95
SetPasswordMethod · 0.95
ErrorRespFunction · 0.92
ErrorStrRespFunction · 0.92
CreateUserFunction · 0.92
SuccessRespFunction · 0.92

Tested by

no test coverage detected