working commit

This commit is contained in:
2026-02-20 15:33:15 +02:00
parent 09f2125a4e
commit f973293315
18 changed files with 169 additions and 147 deletions
+6 -6
View File
@@ -20,7 +20,7 @@ import (
"mstore/pkg/client"
"mstore/pkg/descr"
"mstore/pkg/terms"
"mstore/pkg/term"
"mstore/pkg/uuid"
)
@@ -142,9 +142,9 @@ func (util *GrantUtil) createGrant(common *CommonGrantParams, params *CreateGran
id := strings.ToLower(params.AccountID)
var operRes uuid.UUID
if re.MatchString(id) {
operRes, err = client.NewClient().CreateGrantByAccountID(ctx, hostname, uuid.UUID(id), terms.Right(params.Right), params.Pattern)
operRes, err = client.NewClient().CreateGrantByAccountID(ctx, hostname, uuid.UUID(id), term.Right(params.Right), params.Pattern)
} else {
operRes, err = client.NewClient().CreateGrantByUsername(ctx, hostname, params.AccountID, terms.Right(params.Right), params.Pattern)
operRes, err = client.NewClient().CreateGrantByUsername(ctx, hostname, params.AccountID, term.Right(params.Right), params.Pattern)
}
if err != nil {
return res, err
@@ -259,8 +259,8 @@ type ListGrantsParams struct {
}
type ListGrantsResult struct {
Grants []descr.Grant `yaml:"grants,omitempty"`
Rights map[uuid.UUID]terms.Right `yaml:"rights,omitempty"`
Grants []descr.Grant `yaml:"grants,omitempty"`
Rights map[uuid.UUID]term.Right `yaml:"rights,omitempty"`
}
func (util *GrantUtil) ListGrants(cmd *cobra.Command, args []string) {
@@ -292,7 +292,7 @@ func (util *GrantUtil) listGrants(common *CommonGrantParams, params *ListGrantsP
if params.Detail {
res.Grants = grants
} else {
res.Rights = make(map[uuid.UUID]terms.Right, 0)
res.Rights = make(map[uuid.UUID]term.Right, 0)
for _, item := range grants {
res.Rights[item.ID] = item.Right
}