Adds configuration options and environment variables to manage box owner policies, including settings for refresh counts and expiry.
34 lines
1004 B
Go
34 lines
1004 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (app *App) registerAdminRoutes(router *gin.Engine) {
|
|
admin := router.Group("/admin")
|
|
admin.Use(noStoreAdminHeaders)
|
|
admin.GET("/login", func(ctx *gin.Context) {
|
|
ctx.Redirect(http.StatusSeeOther, "/account/login")
|
|
})
|
|
admin.POST("/login", app.handleAdminLoginPost)
|
|
admin.GET("", func(ctx *gin.Context) {
|
|
ctx.Redirect(http.StatusSeeOther, "/account")
|
|
})
|
|
admin.GET("/", func(ctx *gin.Context) {
|
|
ctx.Redirect(http.StatusSeeOther, "/account")
|
|
})
|
|
|
|
protected := admin.Group("")
|
|
protected.Use(app.requireAdminSession)
|
|
protected.POST("/logout", app.handleAdminLogout)
|
|
protected.GET("/boxes", app.handleAdminBoxes)
|
|
protected.GET("/users", app.handleAdminUsers)
|
|
protected.POST("/users", app.handleAdminUsersPost)
|
|
protected.GET("/tags", app.handleAdminTags)
|
|
protected.POST("/tags", app.handleAdminTagsPost)
|
|
protected.GET("/settings", app.handleAdminSettings)
|
|
protected.POST("/settings", app.handleAdminSettingsPost)
|
|
}
|