Beispiel #1
0
//Mount mount web
func (p *Engine) Mount(r *gin.Engine) {
	rg := r.Group("/ops/mail", p.Jwt.MustRolesHandler("ops"))
	rg.GET("/domains", web.Rest(p.indexDomain))
	rg.POST("/domains", web.Rest(p.createDomain))
	rg.DELETE("/domains/:id", web.Rest(p.deleteDomain))

	rg.GET("/users", web.Rest(p.indexUser))
	rg.POST("/users", web.Rest(p.createUser))
	rg.DELETE("/users/:id", web.Rest(p.deleteUser))

	rg.GET("/aliases", web.Rest(p.indexAlias))
	rg.POST("/aliases", web.Rest(p.createAlias))
	rg.DELETE("/aliases/:id", web.Rest(p.deleteAlias))
}
Beispiel #2
0
//Mount mount routes
func (p *Engine) Mount(r *gin.Engine) {
	ag := r.Group("/admin", p.Jwt.CurrentUserHandler(true), p.Jwt.MustAdminHandler())
	ag.GET("/site/info", p.getAdminSiteInfo)
	ag.POST("/site/info", web.Rest(p.postAdminSiteInfo))
	ag.DELETE("/cache", web.Rest(p.deleteAdminCache))
	ag.GET("/notices", web.Rest(p.getNotices))
	ag.POST("/notices", web.Rest(p.postNotices))
	ag.DELETE("/notices/:id", web.Rest(p.deleteNotice))

	r.GET("/notices", p.Cache.Page(time.Hour*24, web.Rest(p.getNotices)))

	r.GET("/personal/self", p.Jwt.CurrentUserHandler(true), web.Rest(p.getPersonalSelf))
	r.GET("/personal/logs", p.Jwt.CurrentUserHandler(true), web.Rest(p.getPersonalLogs))
	r.DELETE("/personal/signOut", p.Jwt.CurrentUserHandler(true), p.deleteSignOut)

	r.GET("/locales/:lang", p.Cache.Page(time.Hour*24, p.getLocale))
	r.GET("/site/info", p.Cache.Page(time.Hour*24, p.getSiteInfo))

	r.POST("/oauth2/callback", web.Rest(p.postOauth2Callback))
}
Beispiel #3
0
//Mount mount router
func (p *Engine) Mount(r *gin.Engine) {

	gf := r.Group("/reading", p.Jwt.CurrentUserHandler(false))
	gf.GET("/blogs", p.Cache.Page(time.Hour*24, web.Rest(p.indexBlogs)))
	gf.GET("/blog/*name", p.Cache.Page(time.Hour*24, p.showBlog))
	gf.GET("/books", p.Cache.Page(time.Hour*24, web.Rest(p.indexBooks)))
	gf.GET("/book/:id", p.Cache.Page(time.Hour*24, p.indexBook))
	gf.GET("/book/:id/*name", p.Cache.Page(time.Hour*24, p.showBook))
	gf.GET("/dict", p.getDict)
	gf.POST("/dict", p.postDict)

	gt := r.Group("/reading", p.Jwt.CurrentUserHandler(true))
	gt.DELETE("/books/:id", p.Jwt.MustAdminHandler(), web.Rest(p.deleteBook))
	gt.GET("/notes", web.Rest(p.indexNotes))
	gt.POST("/notes", web.Rest(p.createNote))
	gt.GET("/notes/:id", web.Rest(p.showNote))
	gt.POST("/notes/:id", web.Rest(p.updateNote))
	gt.DELETE("/notes/:id", web.Rest(p.deleteNote))
}
Beispiel #4
0
//Mount mount web
func (p *Engine) Mount(r *gin.Engine) {
	rg := r.Group("/ops/vpn", p.Jwt.MustRolesHandler("ops"))
	rg.GET("/users", web.Rest(p.indexUser))
	rg.POST("/users", web.Rest(p.createUser))
	rg.DELETE("/users/:id", web.Rest(p.deleteUser))
}