diff options
Diffstat (limited to 'app/controllers/sparkles/controller.go')
| -rw-r--r-- | app/controllers/sparkles/controller.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/sparkles/controller.go b/app/controllers/sparkles/controller.go index 80e95cb..ef2ecd5 100644 --- a/app/controllers/sparkles/controller.go +++ b/app/controllers/sparkles/controller.go @@ -14,11 +14,15 @@ import ( ) type Controller struct { - db domain.Repository[*domain.Sparkle] + db domain.Repository[*domain.Sparkle] + check authz.CheckPermissionService } -func New(db domain.Repository[*domain.Sparkle], check authz.PermissionService) *Controller { - return &Controller{db: db} +func New(db domain.Repository[*domain.Sparkle], check authz.CheckPermissionService) *Controller { + return &Controller{ + check: check, + db: db, + } } func (c *Controller) MountTo(mux *http.ServeMux) { @@ -26,7 +30,7 @@ func (c *Controller) MountTo(mux *http.ServeMux) { mux.Handle("POST /sparkles", x.Middleware[http.Handler]( http.HandlerFunc(c.Create), middleware.RequireUser(), - // middleware.RequirePermission("create", x.Try(ioc.Resolve[authz.CheckPermission](ioc.Default))), + middleware.RequirePermission("create", c.check), )) // This is a temporary endpoint to restore a backup |
