Beispiel #1
0
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)
}
Beispiel #2
0
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)
}