Is it possible to check on Name/CN during a User creation
Problem is that we define prefix rules
xxx_abc_ (for default value genaration in web interface, prefix must be prefiled if form is clicked)
xxx_abc_{*}
this logic allows the user to click next without supplying text after the prefix. (He can send value xxx_abc_ )
I would like to fix this by checking if there are characters after _abc_
In the debug log i see that SetPolicyComplianceInfo is triggered but i'm not stoped from creating the user
function onCheckPropertyValues($Request) { ######### Control ######### # Form name to match the value from the request $Formname = "NewDeviceUser" # Exit function if request is not for a user if ($Request.Class -ne 'user') { return } # Catch GetInControl NULL try { $Form = $Request.GetInControl("Form") } catch { return } # Check if the form name from the request matches the one defined above if ($Form -eq $Formname) { ######### Controlled Attributes ######### $attCn = "cn" ######### Get Request ######### $cn = $Request.Get($attCn) ######### Policy ######### # Regex pattern: variable part, followed by '_dvc_', and at least one character after that if ($cn -match '.+_dvc_.+') { return } else { $Request.SetPolicyComplianceInfo($attCn, $constants.EDS_POLICY_COMPLIANCE_ERROR, "Invalid: No characters found after '_dvc_'.") } } }
DEBUG: ! SET $cn = 'TEST_DVC_'. DEBUG: 278+ if ( >>>> $cn -match '.+_dvc_.+') {} DEBUG: 280+ >>>> $Request.SetPolicyComplianceInfo($attCn, $constants.EDS_POLICY_COMPLIANCE_ERROR, "Invalid: No characters found after '_dvc_'.") Call method '$Request.SetPolicyComplianceInfo' Arguments list: [1] : Value=cn : Type=System.String [2] : Value=1 : Type=System.Int32 [3] : Value=Invalid: No characters found after '_dvc_'. : Type=System.String [4] : Value=False : Type=System.Boolean Call '$Request.get_PolicyComplianceInformation' DEBUG: 283+ >>>>