Hi Team.
So, I have this code from the Wiki that sets a Virtual Attribute to a readable value based on the account expiry value.
My issue is that I want the VA only to display the date, whereas now it sets the VA with the date and time. I need to ignore the time part.
Any suggestions?
#*********************************************************************************
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
# PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.
#*********************************************************************************
function IsAttributeModified ([string]$AttributeName, $Request)
{
$objEntry = $Request.GetPropertyItem($AttributeName, $Constants.ADSTYPE_CASE_IGNORE_STRING)
if ($objEntry -eq $null) { return $false }
if ($objEntry.ControlCode -eq 0) { return $false }
return $true
} #-- IsAttributeModified
function onPreModify($Request)
{
if($Request.class -ne "user"){return}
if(IsAttributeModified "accountExpires" $Request)
{
[string]$accountExpiresReadable = [datetime]::fromfiletime($Request.Get("accountExpires"))
$DirObj.Put("edsvaAccountExpiresReadable", $accountExpiresReadable)
$DirObj.SetInfo()
}
}
#***** END OF CODE ***************************************************************