Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
devel:documentation:synchronization:dev:tree-sync [2020/06/17 13:08] tomiskar [Automatic roles] |
devel:documentation:synchronization:dev:tree-sync [2021/04/07 19:11] (current) apeterova info about parent attributes |
||
---|---|---|---|
Line 2: | Line 2: | ||
{{tag> sync tree}} | {{tag> sync tree}} | ||
- | An example of organizational structure synchronization can be found in the admin guide. | + | An example of organizational structure synchronization can be found in the [[tutorial: |
=== Basic algorithm === | === Basic algorithm === | ||
* Root search | * Root search | ||
- | * For each root, are recursively searched | + | * For each root are recursively searched |
+ | | ||
<note note> Situation ** The account does not exist **, it is solely based on a comparison of the existence of accounts on the target system against the existence of IDM accounts. </ | <note note> Situation ** The account does not exist **, it is solely based on a comparison of the existence of accounts on the target system against the existence of IDM accounts. </ | ||
==== Finding tree roots ==== | ==== Finding tree roots ==== | ||
- | The roots of the tree are searched over the set of all accounts obtained from the target | + | The roots of the tree are searched over the set of all accounts obtained from the source |
Such a case is, for example, a situation where roots are all the elements (accounts) whose ** parent ** attribute are shown to themselves. | Such a case is, for example, a situation where roots are all the elements (accounts) whose ** parent ** attribute are shown to themselves. | ||
- | Root search is performed using the Groovy script in the synchronization configuration ** tree root / tree definition | + | Root search is performed using the Groovy script in the synchronization configuration ** Definition of tree roots **. This script runs over all system elements. If it returns |
- | <note tip> If the root trace script is not filled, then every element whose ** parent ** attribute is ** null ** is considered to be root. </ | + | <note tip> If the root definition |
** Example of a script addressing the situation described above **: | ** Example of a script addressing the situation described above **: | ||
<code groovy> | <code groovy> | ||
+ | // Name of the attribute in the scheme attributes, which contains the relation to the parent tree node | ||
+ | String PARENT_ATTR_NAME = " | ||
if(account){ | if(account){ | ||
// Get value from parent attribute | // Get value from parent attribute | ||
- | def parentValue = account.getAttributeByName(" | + | def parentValue = account.getAttributeByName(PARENT_ATTR_NAME).getValue(); |
// Get value from ID attribute | // Get value from ID attribute | ||
def uidValue = account.getAttributeByName(" | def uidValue = account.getAttributeByName(" | ||
Line 31: | Line 33: | ||
| | ||
// We need clear value of parent attribute. In IDM has roots always parent = null. | // We need clear value of parent attribute. In IDM has roots always parent = null. | ||
- | | + | |
| | ||
} | } | ||
Line 40: | Line 42: | ||
==== How to synchronize all nodes under one already existing? ==== | ==== How to synchronize all nodes under one already existing? ==== | ||
- | Sometime | + | Sometimes |
- | For definition of that ' | + | For definition of that ' |
- | * The transfromation | + | * The transformation |
- | * Selectbox on UI (configuration of the sync), because we sometime | + | * Selectbox on UI (configuration of the sync), because we sometimes |
- | **Super parent node can be defined in the transformation searching | + | **Super parent node can be defined in the script for " |
- | < | + | < |
<code groovy> | <code groovy> | ||
+ | // Name of the attribute in the scheme attributes, which contains the relation to the parent tree node | ||
+ | String PARENT_ATTR_NAME = " | ||
if(account){ | if(account){ | ||
// Get value from parent attribute | // Get value from parent attribute | ||
- | def parentValue = account.getAttributeByName(" | + | def parentValue = account.getAttributeByName(PARENT_ATTR_NAME).getValue(); |
// Root is account, where is parent value is null | // Root is account, where is parent value is null | ||
| | ||
// Set default node | // Set default node | ||
- | | + | |
| | ||
} | } | ||
Line 70: | Line 73: | ||
{{ : | {{ : | ||
- | <note warning> | + | <note warning> |
<note warning> | <note warning> |