This code example shows how to remove unwanted group members from current operation based on some business logic.
Optimization group members add to avoid "ALREADY_EXIST_VALUE" kind of errors. when IDM engine fails to do so.
Here I am doing look up in AD for members, and for each added member from IDM if user is already member of AD group, i am just striping out current member value from the current operaiton.
<do-set-local-variable name="group-dn" scope="policy"> <arg-string> <token-src-dn /> </arg-string> </do-set-local-variable> <do-set-local-variable name="group-members" scope="policy"> <arg-node-set> <token-dest-attr class-name="Group" name="Member" /> </arg-node-set> </do-set-local-variable> <do-trace-message> <arg-string> <token-text xml:space="preserve">NUMBER OF MEMBERS GROUP => </token-text> <token-xpath expression="count($group-members)" /> </arg-string> </do-trace-message> <do-for-each> <arg-node-set> <token-op-attr name="Member" /> </arg-node-set> <arg-actions> <do-set-local-variable name="current-member" scope="policy"> <arg-string> <token-local-variable name="current-node" /> </arg-string> </do-set-local-variable> <do-trace-message> <arg-string> <token-text xml:space="preserve">CURRENT MEMBER => </token-text> <token-local-variable name="current-node" /> </arg-string> </do-trace-message> <do-if> <arg-conditions> <and> <if-local-variable mode="src-dn" name="group-members" op="equal">$current-member$</if-local-variable> </and> </arg-conditions> <arg-actions> <do-strip-xpath expression="modify-attr[@attr-name="Member"]/add-value/value[text()=$current-node]" /> </arg-actions> <arg-actions /> </do-if> </arg-actions> </do-for-each> <do-strip-xpath expression="modify-attr[@attr-name='Member']/add-value/value[not(text())]" />
Comments