onGetEffectivePolicy not working or not understanding

Hello,

I am really new with Active Roles and perhaps I am not understanding well the basics. I have a "Provisioning Policy", I want to check the members for a group when creating the group and when modifying the members.

I am able to to do it on creating with a Powershell script, but it does not check it on modification and I should do it, as fas a I Know.

This is the script:

function onInit($context){
}

function onGetEffectivePolicy($Request)
{


if($Request.Class -ne "group"){return}

$Request.SetEffectivePolicyInfo("member", $Constants.EDS_EPI_UI_DISPLAY_NOTE, "Los mienmbros posibles son usuarios y grupos. Los grupos deben empezar por GD_")

}

function onCheckPropertyValues($Request)
{


$member = $Request.get("member")


foreach($i in $member)
{
$Type = get-qadobject -identity $i -proxy | Select-Object -expandproperty Type

if (($Type -ne 'group') -and ($Type -ne 'user'))

{

$Request.SetPolicyComplianceInfo("Member", $Constants.EDS_POLICY_COMPLIANCE_ERROR, "El miembre del grupo debe ser un usuario o un grupo", $true)

}
else
{
if ($Type -eq 'group')
{
$CN = get-qadgroup -identity $i -proxy | Select-Object -ExpandProperty name
if($CN -notlike 'Prueba*')

{
$Request.SetPolicyComplianceInfo("Member", $Constants.EDS_POLICY_COMPLIANCE_ERROR, "El nombre del grupo debe comenzar por GR_", $true)

}
}


}


}


}

Could you please help me?

Parents Reply Children
No Data