mirror of
https://github.com/openziti/zrok.git
synced 2025-08-18 03:39:58 +02:00
grants handler wiring (#744)
This commit is contained in:
22
controller/grants.go
Normal file
22
controller/grants.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/admin"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type grantsHandler struct{}
|
||||
|
||||
func newGrantsHandler() *grantsHandler {
|
||||
return &grantsHandler{}
|
||||
}
|
||||
|
||||
func (h *grantsHandler) Handle(params admin.GrantsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
if !principal.Admin {
|
||||
logrus.Errorf("invalid admin principal")
|
||||
return admin.NewGrantsUnauthorized()
|
||||
}
|
||||
return admin.NewGrantsOK()
|
||||
}
|
Reference in New Issue
Block a user