You can configure Adaxes to automatically move objects between Organizational Units based on certain rules. For example, when a new user account is created in Active Directory, Adaxes can automatically move the account to the Organizational Unit that corresponds to the user's city. When the City property of a user account is changed, Adaxes can move the account to the OU associated with the new city. To ensure that all Active Directory objects are always placed into appropriate OUs, you can use Scheduled Tasks to move objects on a periodic basis.
To share the move object rules between different Business Rules and Scheduled Tasks, you can create a Custom Command that will contain all the necessary actions and conditions, and then execute the command in Business Rules and Scheduled Tasks.
In this tutorial, you will learn how to create a Custom Command that will move users between OUs based on their city, and how to execute the command in Business Rules and Scheduled Tasks.
Launch Adaxes Administration Console, right-click your Adaxes service, point to New and click Custom Command.
Enter a name for the new Custom Command.
Since the Custom Command will be executed by Business Rules and Scheduled Tasks only, uncheck the Enabled checkbox. Disabled commands are not displayed in the user interface.
Since the Custom Command will move user accounts, select the User object type and click Next.
On the Parameters step click Next.
On the Actions step click Add an action.
Select the Move the User action.
In the Action Parameters section, select the Organizational Unit that corresponds to one of the cities.
Right-click the newly added action and select Add Condition in the context menu.
Select the If <property> <relation> <value> condition.
In the Condition Parameters section specify City - equals - <City Name>.
Right-click the condition/action block and select Copy in the context menu. To copy the whole block, make sure no actions and conditions are selected.
Right-click the condition/action block again and select Paste in the context menu.
Double-click the action and condition in the pasted Else If block and configure them for another city.
Repeat the steps above for each city.
Optionally, add Else block to move users to a specific Organizational Unit if none of the conditions are met.
With the help of templates, you can create a single action that will move users to different OUs based on user account properties. For this purpose, you need to provide a template that will be used to build the distinguished name (DN) of the target Organizational Unit. For example, to move users to the Organizational Unit that has the same name as the user's city, you can use the following template:
Value reference %l% will be replaced with the value of the City property of user accounts. For example, if the City property of a user account is set to New York, the account will be moved to Organizational Unit OU=New York,DC=example,DC=com.
Click Add an action.
Select the Move the User action.
In the Action Parameters section, click the button.
Activate the Template tab.
In the Template field, specify a template for the distinguished name of the target Organizational Unit.
For more examples, click the View Examples link.
When done, click Next. On the Permissions page, click Finish.
Select a Business Rule or a Scheduled Task that will execute the Custom Command.
Click Add new action set.
Right-click Do nothing and select Add Action in the context menu.
In the Add Action dialog, select Execute a Custom Command.
In the Action Parameters section, select the Custom Command.
If the Custom Command is executed in a Business Rule triggered after updating a user, add the If the City property has changed condition.
Add the Custom Command to other Business Rules and Scheduled Tasks.
To make City a required field and allow users to select a city from a drop-down list, you can use Property Patterns.
Select built-in Property Pattern User Pattern.
In the section located to the right, click Add and select City in the drop-down list.
Check the The property is required checkbox.
Select Must be one of the following values only and click Edit to specify the list of allowed cities.