Skip to content

Commit 8fc4b1e

Browse files
authored
Merge pull request #52 from agilize/bug/change-mfa-enforcement-delay-period
Bug: Change mfa enforcement delay period argument
2 parents 1caa39f + d6b0467 commit 8fc4b1e

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v0.1.12 (2025-07-09)
4+
5+
* Initial release
6+
7+
## v0.1.10 (2025-06-12)
8+
9+
* Initial release
10+
311
## v0.1.9 (2025-05-09)
412

513
* Initial release

jumpcloud/users/users_directory/resource_user.go

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ type SSHKey struct {
5353

5454
// MFAConfig represents a user's MFA configuration
5555
type MFAConfig struct {
56-
Exclusion bool `json:"exclusion,omitempty"`
57-
ExclusionUntil string `json:"exclusionUntil,omitempty"`
58-
Configured bool `json:"configured,omitempty"`
56+
Exclusion bool `json:"exclusion,omitempty"`
57+
ExclusionDays int `json:"exclusionDays,omitempty"`
58+
Configured bool `json:"configured,omitempty"`
5959
}
6060

6161
// MFAEnrollment represents a user's MFA enrollment status
@@ -543,26 +543,29 @@ func ResourceUser() *schema.Resource {
543543
"mfa": {
544544
Type: schema.TypeList,
545545
Optional: true,
546-
Computed: true,
547546
MaxItems: 1,
548547
Elem: &schema.Resource{
549548
Schema: map[string]*schema.Schema{
550549
"exclusion": {
551-
Type: schema.TypeBool,
552-
Optional: true,
553-
Default: false,
550+
Type: schema.TypeBool,
551+
Optional: true,
552+
Default: false,
553+
Description: "Whether the user is excluded from MFA requirements",
554554
},
555-
"exclusion_until": {
556-
Type: schema.TypeString,
557-
Optional: true,
558-
Computed: true,
555+
"exclusion_days": {
556+
Type: schema.TypeInt,
557+
Optional: true,
558+
Description: "Number of days the user is excluded from MFA requirements",
559559
},
560560
"configured": {
561-
Type: schema.TypeBool,
562-
Computed: true,
561+
Type: schema.TypeBool,
562+
Optional: true,
563+
Computed: true,
564+
Description: "Whether MFA is configured for the user",
563565
},
564566
},
565567
},
568+
Description: "MFA configuration for the user",
566569
},
567570
"state": {
568571
Type: schema.TypeString,
@@ -834,8 +837,8 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta any) d
834837
if len(mfaList) > 0 {
835838
mfaMap := mfaList[0].(map[string]any)
836839
user.MFA = MFAConfig{
837-
Exclusion: mfaMap["exclusion"].(bool),
838-
ExclusionUntil: mfaMap["exclusion_until"].(string),
840+
Exclusion: mfaMap["exclusion"].(bool),
841+
ExclusionDays: mfaMap["exclusion_days"].(int),
839842
}
840843
}
841844
}
@@ -1327,9 +1330,9 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta any) dia
13271330
if user.MFA.Configured || user.MFA.Exclusion {
13281331
mfaConfig := []map[string]any{
13291332
{
1330-
"exclusion": user.MFA.Exclusion,
1331-
"exclusion_until": user.MFA.ExclusionUntil,
1332-
"configured": user.MFA.Configured,
1333+
"exclusion": user.MFA.Exclusion,
1334+
"exclusion_days": user.MFA.ExclusionDays,
1335+
"configured": user.MFA.Configured,
13331336
},
13341337
}
13351338
if err := d.Set("mfa", mfaConfig); err != nil {
@@ -1570,8 +1573,8 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta any) d
15701573
if len(mfaList) > 0 {
15711574
mfaMap := mfaList[0].(map[string]any)
15721575
user.MFA = MFAConfig{
1573-
Exclusion: mfaMap["exclusion"].(bool),
1574-
ExclusionUntil: mfaMap["exclusion_until"].(string),
1576+
Exclusion: mfaMap["exclusion"].(bool),
1577+
ExclusionDays: mfaMap["exclusion_days"].(int),
15751578
}
15761579
}
15771580
}

0 commit comments

Comments
 (0)