Files
certmanager/internal/grpc/handler/grant.go
Олег Бородин cab7eac36e certmanager update
2024-08-10 14:46:26 +02:00

32 lines
785 B
Go

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
}