The script only seems to be working if the first condition is met. It is not working if the User2 is met. ($Session.Username -ne "user2") Is there some reason why the -OR isn't working in the IF statement. Any ideas?
function onGetEffectivePolicy($Request)
{
$Session = $Security.Sessions.Current
$UserName = $Session.UserName
if (($Session.UserName -ne "User1") -OR ($Session.UserName -ne "User2" ))
{ Import-Module "C:\ARS\ARSCmdlets.dll" -Force
$testTitlesNoOwner = Get-SsoInfo TitleWithoutOwner
$testTitlesNoOwner
$Request.SetEffectivePolicyInfo('title', $Constants.EDS_EPI_UI_RESTRICTED, $true)
$Request.SetEffectivePolicyInfo('title', $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$testTitlesNoOwner)
}
else
{ Import-Module "C:\ARS\ARSCmdlets.dll" -Force
$testTitlesOwner = Get-SsoInfo Title
$testTitlesOwner
$Request.SetEffectivePolicyInfo('title', $Constants.EDS_EPI_UI_RESTRICTED, $true)
$Request.SetEffectivePolicyInfo('title', $Constants.EDS_EPI_UI_POSSIBLE_VALUES, [string[]]$testTitlesOwner)
}
}