func LiftUser(ctx *middleware.Context, params martini.Params) { id := params["id"] user := new(model.User) user.Id = ParseInt(id) err := user.SetLock(false) PanicIf(err) ctx.Set("success", true) ctx.JSON(200, ctx.Response) }
func SetRole(ctx *middleware.Context) { id := ctx.R.PostFormValue("Id") roleId := ctx.R.PostFormValue("RoleId") version := ctx.R.PostFormValue("Version") user := new(model.User) user.Id = ParseInt(id) user.Role.Id = ParseInt(roleId) user.Version = ParseInt(version) err := user.SetRole() PanicIf(err) ctx.Set("success", true) Log.Info("User: "******" roleId set to ", roleId) ctx.JSON(200, ctx.Response) }