From b838c577640c02a5d07661bbba15024597f6d6bb Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Mon, 14 Sep 2026 16:26:05 +0100 Subject: [PATCH] fix: Re-add ldapdb for ghes team creation --- .gitignore | 1 + github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 11 +++++++++++ github/github-stringify_test.go | 3 ++- github/teams.go | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6b918ae17ff..ca3e62cc7cb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ vendor/ .DS_Store .vscode .claude/ +.zed # vim temp files *.swp diff --git a/github/github-accessors.go b/github/github-accessors.go index 6dbe7453e1b..dcf89371454 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -13414,6 +13414,14 @@ func (c *CreateTeamRequest) GetDescription() string { return *c.Description } +// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetLDAPDN() string { + if c == nil || c.LDAPDN == nil { + return "" + } + return *c.LDAPDN +} + // GetMaintainers returns the Maintainers slice if it's non-nil, nil otherwise. func (c *CreateTeamRequest) GetMaintainers() []string { if c == nil || c.Maintainers == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c0eb4b2f8de..84bbecdf8a4 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -16916,6 +16916,17 @@ func TestCreateTeamRequest_GetDescription(tt *testing.T) { c.GetDescription() } +func TestCreateTeamRequest_GetLDAPDN(tt *testing.T) { + tt.Parallel() + var zeroValue string + c := &CreateTeamRequest{LDAPDN: &zeroValue} + c.GetLDAPDN() + c = &CreateTeamRequest{} + c.GetLDAPDN() + c = nil + c.GetLDAPDN() +} + func TestCreateTeamRequest_GetMaintainers(tt *testing.T) { tt.Parallel() zeroValue := []string{} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 95f6de598c7..b299f91b1d2 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -520,8 +520,9 @@ func TestCreateTeamRequest_String(t *testing.T) { Permission: new(""), ParentTeamID: new(int64(0)), ParentTeamSlug: new(""), + LDAPDN: new(""), } - want := `github.CreateTeamRequest{Name:"", Description:"", Maintainers:[""], RepoNames:[""], Privacy:"", NotificationSetting:"", Permission:"", ParentTeamID:0, ParentTeamSlug:""}` + want := `github.CreateTeamRequest{Name:"", Description:"", Maintainers:[""], RepoNames:[""], Privacy:"", NotificationSetting:"", Permission:"", ParentTeamID:0, ParentTeamSlug:"", LDAPDN:""}` if got := v.String(); got != want { t.Errorf("CreateTeamRequest.String = %v, want %v", got, want) } diff --git a/github/teams.go b/github/teams.go index 63ffbe6e1a3..9856b615a29 100644 --- a/github/teams.go +++ b/github/teams.go @@ -200,6 +200,10 @@ type CreateTeamRequest struct { // The slug of a team to set as the parent team. // Ignored when ParentTeamID is also provided. ParentTeamSlug *string `json:"parent_team_slug,omitempty"` + + // Set the distinguished name (DN) of the LDAP entry to map to a team. This is + // only supported by GitHub Enterprise Server. + LDAPDN *string `json:"ldap_dn,omitempty"` } func (r CreateTeamRequest) String() string {