Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions internal/commands/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ package commands
import (
"encoding/json"

featureFlagsConstants "github.com/checkmarx/ast-cli/internal/constants/feature-flags"
commonParams "github.com/checkmarx/ast-cli/internal/params"
"github.com/checkmarx/ast-cli/internal/services"
"github.com/checkmarx/ast-cli/internal/wrappers"
"github.com/spf13/cobra"
)

func updateGroupValues(input *[]byte, cmd *cobra.Command, groupsWrapper wrappers.GroupsWrapper, featureFlagsWrapper wrappers.FeatureFlagsWrapper) ([]*wrappers.Group, error) {
func updateGroupValues(input *[]byte, cmd *cobra.Command, groupsWrapper wrappers.GroupsWrapper) ([]*wrappers.Group, error) {
groupListStr, _ := cmd.Flags().GetString(commonParams.GroupList)
groups, err := services.CreateGroupsMap(groupListStr, groupsWrapper)
if err != nil {
return groups, err
}
flagResponse, _ := wrappers.GetSpecificFeatureFlag(featureFlagsWrapper, featureFlagsConstants.AccessManagementEnabled)
if !flagResponse.Status {
var info map[string]interface{}
_ = json.Unmarshal(*input, &info)
info["groups"] = services.GetGroupIds(groups)
*input, _ = json.Marshal(info)
}

// we're not checking here status of the feature flag, because of refactoring in AM
var info map[string]interface{}
_ = json.Unmarshal(*input, &info)
info["groups"] = services.GetGroupIds(groups)
*input, _ = json.Marshal(info)

return groups, nil
}
2 changes: 1 addition & 1 deletion internal/commands/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func runCreateProjectCommand(
if err != nil {
return err
}
groups, err := updateGroupValues(&input, cmd, groupsWrapper, featureFlagsWrapper)
groups, err := updateGroupValues(&input, cmd, groupsWrapper)
if err != nil {
return err
}
Expand Down