0 votes

In this case the working example would be that the user would need to add a new title into a list of titles in the title property pattern

ago by (610 points)

1 Answer

0 votes
ago by (294k points)
selected ago by
Best answer

Hello,

Unfortunately, there is no such possibility in any Web interface unless using scripts. There is built-in functionality for managing property patterns only in the Administration console.

0

A script is fine by me. Can you point me to the relevant script to accomplish this?

I already have a script that takes a property pattern list and copies it to a parameter list. I assume it would be similar but in reverse?

Thank you

0
0

Works like a charm.

Can this script be reworked to remove a value as well? Implemented as a separate custom command/script?

+1

Hello,

Here is the updated script.

$propertyName = "company" # TODO: modify me
$propertyPatternDN = "CN=My Pattern,CN=Property Patterns,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
$parameterName = "param-Value" # TODO: modify me

# Get parameter value
$parameterValue = $Context.GetParameterValue($parameterName)

# Bind to the Property Pattern
$userPattern = $Context.BindToObject("Adaxes://$propertyPatternDN")
$values = New-Object System.Collections.ArrayList
$isPropertyRequired = $False
foreach ($item in $userPattern.Items)
{
    if ($item.PropertyName -ne $propertyName)
    {
        continue
    }

    $constraints =  $item.GetConstraints()
    $constraint = $constraints.GetConstraint("ADM_PROPERTYCONSTRAINTCATEGORY_VALUEFORMAT")

    # Check if new value exists
    if ($constraint.Values -notcontains $parameterValue)
    {
        return
    }

    # Get current values
    $constraint.Values | %%{[void]$values.Add($_)}
    $isPropertyRequired = $item.IsPropertyRequired

    # Remove Property Pattern item
    $userPattern.Items.Remove($item)
    break
}

# Add new value
[void]$values.Remove($parameterValue)

# Sort values
$values.Sort()

# Update Property Pattern
$item = $userPattern.Items.Create()
$item.PropertyName = $propertyName
$item.IsPropertyRequired = $isPropertyRequired

$constraints = $item.GetConstraints()
$constraint = $constraints.Create("ADM_PROPERTYCONSTRAINTTYPE_VALUERANGE")
$constraint.AreValuesDenied = $False
$constraint.Values = $values.ToArray()
$constraints.Add($constraint)
$item.SetConstraints($constraints)

# Save the changes
$item.SetInfo()
$userPattern.Items.Add($item)
0

Thank you, both scripts work perfectly.

Related questions

0 votes
1 answer

A little bit of context: There are 3 departments that share 1 Active Directory. Now each department has its own OU. I would like to have an email sent when a user is ... if this is possible without Powershell? If not, is there a pre-existing script for this?

asked Oct 3, 2023 by Cas (200 points)
0 votes
1 answer

The use case we are looking for is providing a list of titles for users to choose from when initiating a re-hire. We already have a title property pattern established and would ... that we can manage the list in one place. Let me know and as always, thanks.

asked Nov 22 by msheppard (610 points)
0 votes
1 answer

In order to add a managed domain does it have to be trusted by the primary domain adaxes is installed an running in? I have set up a domain for testing adaxes and it ... I have set my host file to point the untrusted domain to it's primary Domain Controller.

asked Oct 5, 2022 by mightycabal (1.0k points)
0 votes
1 answer

Automation of user creation based on ServiceNow ticket creation.

asked Jan 24, 2022 by tdetmer (20 points)
0 votes
1 answer

I am trying to trigger processing outside of Active Directory when an account is created based on the source user account that was used. Does Adaxes store the source account anywhere?

asked Oct 9, 2023 by jnordell (20 points)
3,587 questions
3,275 answers
8,300 comments
548,054 users