func GetUsers(c *gin.Context) { users, err := store.GetUserList(c) if err != nil { c.String(500, "Error getting user list. %s", err) return } c.JSON(200, users) }
func GetUsers(c *gin.Context) { users, err := store.GetUserList(c) if err != nil { c.AbortWithStatus(http.StatusInternalServerError) return } c.IndentedJSON(http.StatusOK, users) }
func ShowUsers(c *gin.Context) { user := session.User(c) if !user.Admin { c.AbortWithStatus(http.StatusForbidden) return } users, _ := store.GetUserList(c) token, _ := token.New( token.CsrfToken, user.Login, ).Sign(user.Hash) c.HTML(200, "users.html", gin.H{ "User": user, "Users": users, "Csrf": token, }) }