wip: create/update/delete...
This commit is contained in:
parent
5a933f20c9
commit
7d7af70346
|
@ -336,6 +336,16 @@ func (s *Server) PostAdminCreateLdapPeers(c *gin.Context) {
|
||||||
c.Redirect(http.StatusSeeOther, "/admin/peer/createldap")
|
c.Redirect(http.StatusSeeOther, "/admin/peer/createldap")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) GetAdminDeletePeer(c *gin.Context) {
|
||||||
|
currentUser := s.users.GetUserByKey(c.Query("pkey"))
|
||||||
|
if err := s.DeleteUser(currentUser); err != nil {
|
||||||
|
s.HandleError(c, http.StatusInternalServerError, "Deletion error", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.setAlert(c, "user deleted successfully", "success")
|
||||||
|
c.Redirect(http.StatusSeeOther, "/admin")
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) GetUserQRCode(c *gin.Context) {
|
func (s *Server) GetUserQRCode(c *gin.Context) {
|
||||||
user := s.users.GetUserByKey(c.Query("pkey"))
|
user := s.users.GetUserByKey(c.Query("pkey"))
|
||||||
png, err := user.GetQRCode()
|
png, err := user.GetQRCode()
|
||||||
|
|
|
@ -28,6 +28,7 @@ func SetupRoutes(s *Server) {
|
||||||
admin.POST("/peer/create", s.PostAdminCreatePeer)
|
admin.POST("/peer/create", s.PostAdminCreatePeer)
|
||||||
admin.GET("/peer/createldap", s.GetAdminCreateLdapPeers)
|
admin.GET("/peer/createldap", s.GetAdminCreateLdapPeers)
|
||||||
admin.POST("/peer/createldap", s.PostAdminCreateLdapPeers)
|
admin.POST("/peer/createldap", s.PostAdminCreateLdapPeers)
|
||||||
|
admin.GET("/peer/delete", s.GetAdminDeletePeer)
|
||||||
|
|
||||||
// User routes
|
// User routes
|
||||||
user := s.server.Group("/user")
|
user := s.server.Group("/user")
|
||||||
|
|
Loading…
Reference in New Issue