Skip to content

Commit 878581e

Browse files
authored
1099 fix multi-valued user attributes cannot be enabled (#1106)
* 1099 fix multi-valued user attributes cannot be enabled Signed-off-by: Sebastian Schuster <[email protected]> * Fixed test failure with KC<24 Signed-off-by: Sebastian Schuster <[email protected]> * Also enabled CodeQL on release branches Signed-off-by: Sebastian Schuster <[email protected]> --------- Signed-off-by: Sebastian Schuster <[email protected]>
1 parent 5f4347a commit 878581e

3 files changed

+17
-4
lines changed

.github/workflows/codeql-analysis.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ main ]
16+
branches:
17+
- "main"
18+
- "release/*"
1719
paths-ignore:
1820
- '**/*.md'
1921
pull_request:
2022
# The branches below must be a subset of the branches above
21-
branches: [ main ]
23+
branches:
24+
- "main"
25+
- "release/*"
2226
paths-ignore:
2327
- '**/*.md'
2428
schedule:

provider/resource_keycloak_realm_user_profile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func getRealmUserProfileAttributeFromData(m map[string]interface{}) *keycloak.Re
158158
Group: m["group"].(string),
159159
}
160160

161-
if v, ok := m["multivalued"].(bool); ok {
161+
if v, ok := m["multi_valued"].(bool); ok {
162162
attribute.MultiValued = v
163163
} else {
164164
attribute.MultiValued = false

provider/resource_keycloak_realm_user_profile_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,19 @@ func TestAccKeycloakRealmUserProfile_basicFull(t *testing.T) {
9999

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

102+
mvSupported, err := keycloakClient.VersionIsGreaterThanOrEqualTo(testCtx, keycloak.Version_24)
103+
if err != nil {
104+
t.Errorf("error checking keycloak version: %v", err)
105+
}
106+
102107
realmUserProfile := &keycloak.RealmUserProfile{
103108
Attributes: []*keycloak.RealmUserProfileAttribute{
104109
{Name: "username"}, {Name: "email"}, // Version >=23 needs these
105110
{Name: "attribute1"},
106111
{
107112
Name: "attribute2",
108113
DisplayName: "attribute 2",
109-
MultiValued: false,
114+
MultiValued: mvSupported,
110115
Group: "group",
111116
Selector: &keycloak.RealmUserProfileSelector{Scopes: []string{"roles"}},
112117
Required: &keycloak.RealmUserProfileRequired{
@@ -545,6 +550,10 @@ resource "keycloak_realm_user_profile" "realm_user_profile" {
545550
display_name = "{{ $attribute.DisplayName }}"
546551
{{- end }}
547552
553+
{{- if $attribute.MultiValued }}
554+
multi_valued = "{{ $attribute.MultiValued }}"
555+
{{- end }}
556+
548557
{{- if $attribute.Group }}
549558
group = "{{ $attribute.Group }}"
550559
{{- end }}

0 commit comments

Comments
 (0)