@@ -233,12 +233,12 @@ func GetEntryColor(entry *ldap.Entry) (tcell.Color, bool) {
233233 return baseTheme .PrimaryTextColor , false
234234}
235235
236- func GetAttrCellColor (cellName string , cellValue string ) (string , bool ) {
236+ func GetAttrCellColor (cellName string , cellValue ldaputils. FormattedAttrValue ) (string , bool ) {
237237 var color string = ""
238238
239239 switch cellName {
240240 case "lastLogonTimestamp" , "accountExpires" , "badPasswordTime" , "lastLogoff" , "lastLogon" , "pwdLastSet" , "creationTime" , "lockoutTime" :
241- intValue , err := strconv .ParseInt (cellValue , 10 , 64 )
241+ intValue , err := strconv .ParseInt (cellValue . OriginalValue , 10 , 64 )
242242 if err == nil {
243243 unixTime := (intValue - 116444736000000000 ) / 10000000
244244 t := time .Unix (unixTime , 0 ).UTC ()
@@ -257,7 +257,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
257257 color = "gray"
258258 case "whenCreated" , "whenChanged" :
259259 layout := "20060102150405.0Z"
260- t , err := time .Parse (layout , cellValue )
260+ t , err := time .Parse (layout , cellValue . OriginalValue )
261261 if err == nil {
262262 daysDiff := int (time .Since (t ).Hours () / 24 )
263263
@@ -270,7 +270,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
270270 }
271271 }
272272 case "lockoutDuration" , "msDS-LockoutDuration" , "lockOutObservationWindow" , "msDS-LockoutObservationWindow" :
273- duration , err := ldaputils .ParseMSDuration (cellValue )
273+ duration , err := ldaputils .ParseMSDuration (cellValue . OriginalValue )
274274 if err == nil {
275275 if duration <= 5 * 60 * time .Second {
276276 color = "green"
@@ -281,7 +281,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
281281 }
282282 }
283283 case "maxPwdAge" , "msDS-MaximumPasswordAge" :
284- duration , err := ldaputils .ParseMSDuration (cellValue )
284+ duration , err := ldaputils .ParseMSDuration (cellValue . OriginalValue )
285285 if err == nil {
286286 if duration <= 30 * 24 * time .Hour {
287287 color = "red"
@@ -292,7 +292,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
292292 }
293293 }
294294 case "minPwdAge" , "msDS-MinimumPasswordAge" :
295- duration , err := ldaputils .ParseMSDuration (cellValue )
295+ duration , err := ldaputils .ParseMSDuration (cellValue . OriginalValue )
296296 if err == nil {
297297 if duration == 0 * time .Second {
298298 color = "green"
@@ -303,7 +303,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
303303 }
304304 }
305305 case "forceLogoff" :
306- duration , err := ldaputils .ParseMSDuration (cellValue )
306+ duration , err := ldaputils .ParseMSDuration (cellValue . OriginalValue )
307307 if err == nil {
308308 if duration == 0 * time .Second {
309309 color = "red"
@@ -314,7 +314,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
314314 }
315315 }
316316 case "msDS-UserTGTLifetime" , "msDS-ComputerTGTLifetime" , "msDS-ServiceTGTLifetime" :
317- duration , err := ldaputils .ParseMSDuration (cellValue )
317+ duration , err := ldaputils .ParseMSDuration (cellValue . OriginalValue )
318318 if err == nil {
319319 if duration >= 24 * time .Hour {
320320 color = "green"
@@ -325,7 +325,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
325325 }
326326 }
327327 case "lockoutThreshold" , "msDS-LockoutThreshold" :
328- intValue , err := strconv .ParseInt (cellValue , 10 , 64 )
328+ intValue , err := strconv .ParseInt (cellValue . OriginalValue , 10 , 64 )
329329 if err == nil {
330330 if intValue == 0 {
331331 color = "green"
@@ -336,7 +336,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
336336 }
337337 }
338338 case "minPwdLength" , "msDS-MinimumPasswordLength" :
339- intValue , err := strconv .ParseInt (cellValue , 10 , 64 )
339+ intValue , err := strconv .ParseInt (cellValue . OriginalValue , 10 , 64 )
340340 if err == nil {
341341 if intValue >= 12 {
342342 color = "red"
@@ -347,7 +347,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
347347 }
348348 }
349349 case "badPwdCount" :
350- intValue , err := strconv .ParseInt (cellValue , 10 , 64 )
350+ intValue , err := strconv .ParseInt (cellValue . OriginalValue , 10 , 64 )
351351 if err == nil {
352352 if intValue > 0 {
353353 color = "yellow"
@@ -356,7 +356,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
356356 }
357357 }
358358 case "logonCount" :
359- intValue , err := strconv .ParseInt (cellValue , 10 , 64 )
359+ intValue , err := strconv .ParseInt (cellValue . OriginalValue , 10 , 64 )
360360 if err == nil {
361361 if intValue >= 10 {
362362 color = "green"
@@ -368,7 +368,7 @@ func GetAttrCellColor(cellName string, cellValue string) (string, bool) {
368368 }
369369 }
370370
371- switch cellValue {
371+ switch cellValue . FormattedValue {
372372 case "TRUE" , "Enabled" , "Normal" , "PwdNotExpired" :
373373 color = "green"
374374 case "FALSE" , "NotNormal" , "PwdExpired" :
0 commit comments