Created by
- {{ .Account.Username }}
+ {{ .Account.Username }}
at {{ .Version.Created }}
diff --git a/pkg/webui/index.go b/pkg/webui/index.go
index 1168098..28a4964 100644
--- a/pkg/webui/index.go
+++ b/pkg/webui/index.go
@@ -8,6 +8,7 @@ import (
)
type Page struct {
+ IsAdmin bool
LightMode bool
Precedent string
Section string
@@ -15,6 +16,8 @@ type Page struct {
}
func makePage(r *http.Request, page *Page) *Page {
+ account := r.Context().Value(model.AccountContextKey{}).(*model.Account)
+ page.IsAdmin = account.IsAdmin
settings := r.Context().Value(model.SettingsContextKey{}).(*model.Settings)
page.LightMode = settings.LightMode
return page
diff --git a/pkg/webui/routes.go b/pkg/webui/routes.go
index 1fce700..2037df6 100644
--- a/pkg/webui/routes.go
+++ b/pkg/webui/routes.go
@@ -12,6 +12,8 @@ func addRoutes(
) {
requireSession := sessionsMiddleware(db)
requireLogin := loginMiddleware(db, requireSession)
+ requireAdmin := adminMiddleware(db, requireLogin)
+ mux.Handle("GET /accounts", requireAdmin(handleAccountsGET(db)))
mux.Handle("GET /healthz", handleHealthz())
mux.Handle("GET /login", requireSession(handleLoginGET()))
mux.Handle("POST /login", requireSession(handleLoginPOST(db)))