working commit
This commit is contained in:
@@ -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, ".*")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"mstore/app/descr"
|
||||
"mstore/pkg/client"
|
||||
"mstore/pkg/descr"
|
||||
)
|
||||
|
||||
func (util *GrantUtil) CreateGrantCmds() *cobra.Command {
|
||||
|
||||
Reference in New Issue
Block a user