Browse Source

v1.5.0: remove duration field

abhishek9686 1 week ago
parent
commit
cc0982e456
1 changed files with 0 additions and 28 deletions
  1. 0 28
      pro/email/jit_approved.go

+ 0 - 28
pro/email/jit_approved.go

@@ -45,15 +45,12 @@ func (mail JITApprovedMail) GetSubject(info Notification) string {
 
 // GetBody - gets the body of the email
 func (mail JITApprovedMail) GetBody(info Notification) string {
-	durationText := formatDuration(mail.Request.DurationHours)
-
 	content := mail.BodyBuilder.
 		WithHeadline("JIT Access Approved").
 		WithParagraph(fmt.Sprintf("Your request for Just-In-Time access to network <strong>%s</strong> has been approved.", mail.Network.NetID)).
 		WithParagraph("Access Details:").
 		WithHtml("<ul>").
 		WithHtml(fmt.Sprintf("<li><strong>Network:</strong> %s</li>", mail.Network.NetID)).
-		WithHtml(fmt.Sprintf("<li><strong>Duration:</strong> %s</li>", durationText)).
 		WithHtml(fmt.Sprintf("<li><strong>Granted At:</strong> %s</li>", formatUTCTime(mail.Grant.GrantedAt))).
 		WithHtml(fmt.Sprintf("<li><strong>Expires At:</strong> %s</li>", formatUTCTime(mail.Grant.ExpiresAt))).
 		WithHtml(fmt.Sprintf("<li><strong>Approved By:</strong> %s</li>", mail.Request.ApprovedBy)).
@@ -65,28 +62,3 @@ func (mail JITApprovedMail) GetBody(info Notification) string {
 
 	return content
 }
-
-// formatDuration - formats duration hours into human-readable text
-func formatDuration(hours int) string {
-	switch hours {
-	case 24:
-		return "24 hours"
-	case 168:
-		return "1 week"
-	case 720:
-		return "1 month"
-	default:
-		if hours < 24 {
-			return fmt.Sprintf("%d hours", hours)
-		} else if hours < 168 {
-			days := hours / 24
-			return fmt.Sprintf("%d day(s)", days)
-		} else if hours < 720 {
-			weeks := hours / 168
-			return fmt.Sprintf("%d week(s)", weeks)
-		} else {
-			months := hours / 720
-			return fmt.Sprintf("%d month(s)", months)
-		}
-	}
-}