summaryrefslogtreecommitdiff
path: root/app/controllers/sparkles/controller.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-24 00:16:14 -0600
committermo khan <mo@mokhan.ca>2025-05-24 00:16:14 -0600
commit23327d0ce3e641afd1316a112e1c7f9b443abe13 (patch)
tree0876c4a759cb52358afe2508c78d54e0513bf89f /app/controllers/sparkles/controller.go
parenta8e47145f93f07740d751be37d450599b26b2fc8 (diff)
refactor: decorate handler with access check middleware
Diffstat (limited to 'app/controllers/sparkles/controller.go')
-rw-r--r--app/controllers/sparkles/controller.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/sparkles/controller.go b/app/controllers/sparkles/controller.go
index cd86cd2..bd7264e 100644
--- a/app/controllers/sparkles/controller.go
+++ b/app/controllers/sparkles/controller.go
@@ -21,10 +21,12 @@ func New(db domain.Repository[*domain.Sparkle]) *Controller {
}
func (c *Controller) MountTo(mux *http.ServeMux) {
- requireUser := middleware.RequireUser()
-
mux.HandleFunc("GET /sparkles", c.Index)
- mux.Handle("POST /sparkles", requireUser(http.HandlerFunc(c.Create)))
+ mux.Handle("POST /sparkles", x.Middleware[http.Handler](
+ http.HandlerFunc(c.Create),
+ middleware.RequireUser(),
+ // middleware.RequirePermission("create_sparkle", nil),
+ ))
// This is a temporary endpoint to restore a backup
mux.HandleFunc("POST /sparkles/restore", c.Restore)