Skip to content

Commit

Permalink
Merge pull request #1531 from timofurrer/fix-group-saml
Browse files Browse the repository at this point in the history
Fix SAML Group Links Access Level type
  • Loading branch information
svanharmelen committed Aug 23, 2022
2 parents 88c4146 + c6383e6 commit e3c6ee4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions groups.go
Expand Up @@ -105,8 +105,8 @@ type LDAPGroupLink struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#saml-group-links
type SAMLGroupLink struct {
Name string `json:"name"`
AccessLevel string `json:"access_level"`
Name string `json:"name"`
AccessLevel AccessLevelValue `json:"access_level"`
}

// ListGroupsOptions represents the available ListGroups() options.
Expand Down Expand Up @@ -810,8 +810,8 @@ func (s *GroupsService) GetGroupSAMLLink(gid interface{}, samlGroupName string,
// GitLab API docs:
// https://docs.gitlab.com/ee/api/groups.html#add-saml-group-link
type AddGroupSAMLLinkOptions struct {
SAMLGroupName *string `url:"saml_group_name,omitempty" json:"saml_group_name,omitempty"`
AccessLevel *string `url:"access_level,omitempty" json:"access_level,omitempty"`
SAMLGroupName *string `url:"saml_group_name,omitempty" json:"saml_group_name,omitempty"`
AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
}

// AddGroupSAMLLink creates a new group SAML link. Available only for users who
Expand Down
18 changes: 9 additions & 9 deletions groups_test.go
Expand Up @@ -373,11 +373,11 @@ func TestListGroupSAMLLinks(t *testing.T) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `[
{
"access_level":"Developer",
"access_level":30,
"name":"gitlab_group_example_developer"
},
{
"access_level":"Maintainer",
"access_level":40,
"name":"gitlab_group_example_maintainer"
}
]`)
Expand All @@ -390,11 +390,11 @@ func TestListGroupSAMLLinks(t *testing.T) {

want := []*SAMLGroupLink{
{
AccessLevel: "Developer",
AccessLevel: DeveloperPermissions,
Name: "gitlab_group_example_developer",
},
{
AccessLevel: "Maintainer",
AccessLevel: MaintainerPermissions,
Name: "gitlab_group_example_maintainer",
},
}
Expand All @@ -412,7 +412,7 @@ func TestGetGroupSAMLLink(t *testing.T) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `
{
"access_level":"Developer",
"access_level":30,
"name":"gitlab_group_example_developer"
}`)
})
Expand All @@ -423,7 +423,7 @@ func TestGetGroupSAMLLink(t *testing.T) {
}

want := &SAMLGroupLink{
AccessLevel: "Developer",
AccessLevel: DeveloperPermissions,
Name: "gitlab_group_example_developer",
}
if !reflect.DeepEqual(want, links) {
Expand All @@ -440,14 +440,14 @@ func TestAddGroupSAMLLink(t *testing.T) {
testMethod(t, r, http.MethodPost)
fmt.Fprint(w, `
{
"access_level":"Developer",
"access_level":30,
"name":"gitlab_group_example_developer"
}`)
})

opt := &AddGroupSAMLLinkOptions{
SAMLGroupName: String("gitlab_group_example_developer"),
AccessLevel: String("Developer"),
AccessLevel: AccessLevel(DeveloperPermissions),
}

link, _, err := client.Groups.AddGroupSAMLLink(1, opt)
Expand All @@ -456,7 +456,7 @@ func TestAddGroupSAMLLink(t *testing.T) {
}

want := &SAMLGroupLink{
AccessLevel: "Developer",
AccessLevel: DeveloperPermissions,
Name: "gitlab_group_example_developer",
}
if !reflect.DeepEqual(want, link) {
Expand Down

0 comments on commit e3c6ee4

Please sign in to comment.