working commit

This commit is contained in:
2026-02-19 11:55:17 +02:00
parent 1fd55521de
commit bb0f58f46c
37 changed files with 231 additions and 150 deletions
+8 -7
View File
@@ -17,8 +17,9 @@ import (
"github.com/spf13/cobra"
"mstore/app/descr"
"mstore/pkg/client"
"mstore/pkg/descr"
"mstore/pkg/terms"
)
const (
@@ -145,12 +146,12 @@ func (util *AccountUtil) createAccount(common *CommonAccountParams, params *Crea
}
fullRights := []string{
descr.RightWriteAccounts,
descr.RightReadAccounts,
descr.RightWriteFiles,
descr.RightReadFiles,
descr.RightWriteImages,
descr.RightReadImages,
terms.RightWriteAccounts,
terms.RightReadAccounts,
terms.RightWriteFiles,
terms.RightReadFiles,
terms.RightWriteImages,
terms.RightReadImages,
}
for _, right := range fullRights {
id, err := client.NewClient().CreateGrantByAccountID(ctx, hostname, accountID, right, ".*")
+14 -6
View File
@@ -21,8 +21,9 @@ import (
"github.com/spf13/cobra"
"mstore/app/descr"
"mstore/pkg/client"
"mstore/pkg/descr"
"mstore/pkg/terms"
)
func (util *FileUtil) CreateFileCmds() *cobra.Command {
@@ -131,7 +132,7 @@ func (util *FileUtil) CreateCollectionCmds() *cobra.Command {
Run: util.DeleteCollection,
}
deleteCollectionCmd.Flags().BoolVarP(&util.deleteCollectionParams.Detail, "detail", "D", false, "Show detail file information")
deleteCollectionCmd.Flags().BoolVarP(&util.deleteCollectionParams.Recursive, "recursive", "R", false, "Use path as collection pattern")
deleteCollectionCmd.Flags().BoolVarP(&util.deleteCollectionParams.AsPrefix, "asPrefix", "P", true, "Use path as collection path prefix")
subCmd.AddCommand(deleteCollectionCmd)
@@ -428,9 +429,9 @@ func (util *FileUtil) listCollections(common *CommonFileParams, params *ListColl
// DeleteCollection
type DeleteCollectionParams struct {
Path string
Detail bool
Recursive bool
Path string
Detail bool
AsPrefix bool
}
type DeleteCollectionResult struct {
@@ -454,7 +455,14 @@ func (util *FileUtil) deleteCollection(common *CommonFileParams, params *DeleteC
}
timeout := time.Duration(common.Timeout) * time.Second
ctx, _ := context.WithTimeout(context.Background(), timeout)
files, err := client.NewClient().DeleteCollection(ctx, params.Path, params.Recursive)
var pathAs terms.PathAs
switch {
case params.AsPrefix:
pathAs = terms.AsPrefix
default:
pathAs = terms.AsFinePath
}
files, err := client.NewClient().DeleteCollection(ctx, params.Path, pathAs)
if err != nil {
return res, err
}
+1 -1
View File
@@ -17,8 +17,8 @@ import (
"github.com/spf13/cobra"
"mstore/app/descr"
"mstore/pkg/client"
"mstore/pkg/descr"
)
func (util *GrantUtil) CreateGrantCmds() *cobra.Command {