Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1099 fix multi-valued user attributes cannot be enabled #1106

Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches:
- "main"
- "release/*"
paths-ignore:
- '**/*.md'
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches:
- "main"
- "release/*"
paths-ignore:
- '**/*.md'
schedule:
Expand Down
2 changes: 1 addition & 1 deletion provider/resource_keycloak_realm_user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func getRealmUserProfileAttributeFromData(m map[string]interface{}) *keycloak.Re
Group: m["group"].(string),
}

if v, ok := m["multivalued"].(bool); ok {
if v, ok := m["multi_valued"].(bool); ok {
attribute.MultiValued = v
} else {
attribute.MultiValued = false
Expand Down
11 changes: 10 additions & 1 deletion provider/resource_keycloak_realm_user_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@ func TestAccKeycloakRealmUserProfile_basicFull(t *testing.T) {

realmName := acctest.RandomWithPrefix("tf-acc")

mvSupported, err := keycloakClient.VersionIsGreaterThanOrEqualTo(testCtx, keycloak.Version_24)
if err != nil {
t.Errorf("error checking keycloak version: %v", err)
}

realmUserProfile := &keycloak.RealmUserProfile{
Attributes: []*keycloak.RealmUserProfileAttribute{
{Name: "username"}, {Name: "email"}, // Version >=23 needs these
{Name: "attribute1"},
{
Name: "attribute2",
DisplayName: "attribute 2",
MultiValued: false,
MultiValued: mvSupported,
Group: "group",
Selector: &keycloak.RealmUserProfileSelector{Scopes: []string{"roles"}},
Required: &keycloak.RealmUserProfileRequired{
Expand Down Expand Up @@ -545,6 +550,10 @@ resource "keycloak_realm_user_profile" "realm_user_profile" {
display_name = "{{ $attribute.DisplayName }}"
{{- end }}

{{- if $attribute.MultiValued }}
multi_valued = "{{ $attribute.MultiValued }}"
{{- end }}

{{- if $attribute.Group }}
group = "{{ $attribute.Group }}"
{{- end }}
Expand Down