working commit

This commit is contained in:
2026-06-07 18:19:15 +02:00
parent d3556d397c
commit 0506b35cd1
26 changed files with 199 additions and 1299 deletions
+26 -6
View File
@@ -4,20 +4,40 @@
package grant
import (
"context"
"mbase/pkg/mbctl"
"github.com/spf13/cobra"
)
func (util *Util) DeleteGrant(cmd *cobra.Command, args []string) {
//util.deleteGrantParams.Filename = args[0]
res, err := util.deleteGrant(util.deleteGrantParams)
util.deleteGrantParams.Username = args[0]
util.deleteGrantParams.Operation = args[1]
res, err := util.deleteGrant(&util.deleteGrantParams)
printResponse(res, err)
}
type deleteGrantParams struct{}
type deleteGrantResult struct{}
type DeleteGrantParams struct {
Username string
Operation string
}
type DeleteGrantResult struct {
GrantID string `json:"grantId"`
}
func (util *Util) deleteGrant(params deleteGrantParams) (deleteGrantResult, error) {
func (util *Util) deleteGrant(params *DeleteGrantParams) (*DeleteGrantResult, error) {
var err error
res := deleteGrantResult{}
res := &DeleteGrantResult{}
ctx := context.Background()
operParams := &mbctl.SetGrantParams{
Username: params.Username,
Operation: params.Operation,
}
operRes, err := util.oper.SetGrant(ctx, util.operID, operParams)
if err != nil {
return res, err
}
res.GrantID = operRes.GrantID
return res, err
}