Cybersecurity
DevOps Cloud
IT Operations Cloud
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\NetIQ\idm\apps\Designer\plugins\com.novell.idm.policybuilder_4.0.0.201509291552\DTD\dirxmlscript4.5.1.dtd"><policy>
<rule>
<description>Read the user CN from the filename and update the user photo</description>
<conditions>
<and>
<if-class-name mode="nocase" op="equal">User</if-class-name>
<if-op-attr name="photo" op="available"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="varName" scope="policy">
<arg-string>
<token-replace-all regex="\.jpg" replace-with="">
<token-op-attr name="fileName"/>
</token-replace-all>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="varFilePath" scope="policy">
<arg-string>
<token-op-attr name="filePath"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="varUser" scope="policy">
<arg-node-set>
<token-query class-name="User">
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="varName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">CN</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-dest-attr-value direct="true" name="photo">
<arg-dn>
<token-xpath expression="$varUser/@src-dn"/>
</arg-dn>
<arg-value type="octet">
<token-xpath expression="es:readImage($varFilePath)"/>
</arg-value>
</do-set-dest-attr-value>
<do-veto/>
</actions>
</rule>
</policy>