swagger, require admin token for update user

This commit is contained in:
kiwiidb
2023-05-24 12:53:30 +02:00
parent c9dd382027
commit b890c2c8ec
7 changed files with 248 additions and 12 deletions

View File

@@ -12,7 +12,10 @@ func RegisterV2Endpoints(svc *service.LndhubService, e *echo.Echo, secured *echo
if svc.Config.AllowAccountCreation {
e.POST("/v2/users", v2controllers.NewCreateUserController(svc).CreateUser, strictRateLimitMiddleware, adminMw)
}
e.PUT("/v2/admin/users", v2controllers.NewUpdateUserController(svc).UpdateUser, strictRateLimitMiddleware, adminMw)
//require admin token for update user endpoint
if svc.Config.AdminToken != "" {
e.PUT("/v2/admin/users", v2controllers.NewUpdateUserController(svc).UpdateUser, strictRateLimitMiddleware, adminMw)
}
invoiceCtrl := v2controllers.NewInvoiceController(svc)
keysendCtrl := v2controllers.NewKeySendController(svc)
secured.POST("/v2/invoices", invoiceCtrl.AddInvoice)