Skip to content

Commit

Permalink
remove ldapgroups, comment on exported fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gypsydiver committed Dec 15, 2018
1 parent 1837ec4 commit 38dcae1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
9 changes: 0 additions & 9 deletions jumpcloud/structures_user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

func flattenAttributes(attr *Attributes) map[string]interface{} {
return map[string]interface{}{
"ldap_groups": flattenLDAPGroups(attr.LDAPGroups),
"posix_groups": flattenPOSIXGroups(attr.POSIXGroups),
}
}
Expand All @@ -23,14 +22,6 @@ func flattenPOSIXGroups(pg []jcapiv2.UserGroupPostAttributesPosixGroups) string
return strings.Join(out, ",")
}

func flattenLDAPGroups(lg []LDAPGroup) string {
out := []string{}
for _, v := range lg {
out = append(out, v.Name)
}
return strings.Join(out, ",")
}

// Note: PosixGroups cannot be edited after group creation, only first member of slice is considered
func expandAttributes(attr interface{}) (out *jcapiv2.UserGroupPostAttributes, ok bool) {
if attr == nil {
Expand Down
15 changes: 6 additions & 9 deletions jumpcloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ package jumpcloud

import jcapiv2 "github.com/TheJumpCloud/jcapi-go/v2"

// UserGroup is like github.com/TheJumpCloud/jcapi-go/v2.UserGroup but with Attributes and go best practices
type UserGroup struct {
// ObjectId uniquely identifying a User Group.
Id string `json:"id,omitempty"`
// ID uniquely identifies a User Group.
ID string `json:"id,omitempty"`

// The type of the group.
Type_ string `json:"type,omitempty"`
// Type is the type of the group.
Type string `json:"type,omitempty"`

// Display name of a User Group.
Name string `json:"name,omitempty"`
Attributes Attributes `json:"attributes,omitempty"`
}

// Attributes holds UserGroup properties relevant for updates
type Attributes struct {
LDAPGroups []LDAPGroup `json:"ldapGroups,omitempty"`
POSIXGroups []jcapiv2.UserGroupPostAttributesPosixGroups `json:"posixGroups,omitempty"`
// SambaEnabled bool `json:"sambaEnable,omitempty"`
}

type LDAPGroup struct {
Name string `json:"name,omitempty"`
}

0 comments on commit 38dcae1

Please sign in to comment.