Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add list ldap groups command
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdelacroix committed Apr 17, 2019
1 parent d90cc51 commit d38dc8c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions commands/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ var GroupCmd = &cobra.Command{
Short: "Management of groups",
}

var ListLdapGroupsCmd = &cobra.Command{
Use: "list-ldap",
Short: "List LDAP groups",
Example: " group list-ldap",
Args: cobra.NoArgs,
RunE: listLdapGroupsCmdF,
}

var ChannelGroupCmd = &cobra.Command{
Use: "channel",
Short: "Management of channel groups",
Expand Down Expand Up @@ -106,13 +114,32 @@ func init() {
)

GroupCmd.AddCommand(
ListLdapGroupsCmd,
ChannelGroupCmd,
TeamGroupCmd,
)

RootCmd.AddCommand(GroupCmd)
}

func listLdapGroupsCmdF(command *cobra.Command, args []string) error {
c, err := InitClient()
if err != nil {
return err
}

groups, res := c.GetLdapGroups()
if res.Error != nil {
return res.Error
}

for _, group := range groups {
fmt.Println(group)
}

return nil
}

func channelGroupEnableCmdF(command *cobra.Command, args []string) error {
c, err := InitClient()
if err != nil {
Expand Down

0 comments on commit d38dc8c

Please sign in to comment.