certmanager update
This commit is contained in:
31
internal/grpc/handler/grant.go
Normal file
31
internal/grpc/handler/grant.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"certmanager/pkg/cmctl"
|
||||
)
|
||||
|
||||
func (hand *Handler) SetGrant(ctx context.Context, params *cmctl.SetGrantParams) (*cmctl.SetGrantResult, error) {
|
||||
var err error
|
||||
hand.log.Debugf("Handle SetGrant call")
|
||||
res := &cmctl.SetGrantResult{}
|
||||
userID, err := hand.Authentificate(ctx)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res, err = hand.lg.SetGrant(ctx, userID, params)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (hand *Handler) DeleteGrant(ctx context.Context, params *cmctl.DeleteGrantParams) (*cmctl.DeleteGrantResult, error) {
|
||||
var err error
|
||||
hand.log.Debugf("Handle DeleteGrant call")
|
||||
res := &cmctl.DeleteGrantResult{}
|
||||
userID, err := hand.Authentificate(ctx)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
res, err = hand.lg.DeleteGrant(ctx, userID, params)
|
||||
return res, err
|
||||
}
|
||||
Reference in New Issue
Block a user