Novell Home

IDM Token-Unique-Name Examples

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 24 Oct 2007
 

Problem

A Forum reader recently asked:

"I need to see an entire policy rule so that I can see how the <token-unique-name> noun is used. Can anyone post an entire rule so I can see how it's used?"

And here are the responses from David Gersic and Father Ramon ...

Solution

David Gersic

Here's one example, kind of trivial:

<?xml version="1.0" encoding="UTF-8"?><policy>
 <rule>
  <description>Create CN for new user</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
   </and>
  </conditions>
  <actions>
   <do-set-local-variable name="wfid">
    <arg-string>
     <token-attr name="workforceID"/>
    </arg-string>
   </do-set-local-variable>
   <do-set-dest-attr-value name="CN">
    <arg-value type="string">
     <token-unique-name name="CN" scope="subtree">
      <arg-string>
       <token-text xml:space="preserve"
xmlns:xml="http://www.w3.org/XML/1998/namespace">X</token-text>
       <token-xpath expression="string(number($wfid))"/>
      </arg-string>
     </token-unique-name>
    </arg-value>
   </do-set-dest-attr-value>
  </actions>
 </rule>
</policy>

Here's a more interesting example:

<?xml version="1.0" encoding="UTF-8"?><policy>
 <rule>
  <description>Create CN for new user</description>
  <conditions>
   <and>
    <if-class-name op="equal">User</if-class-name>
   </and>
  </conditions>
  <actions>
   <do-set-dest-attr-value name="CN">
    <arg-value type="string">
     <token-unique-name counter-digits="6" counter-pattern="last"
counter-use="fallback" name="CN" on-unavailable="error" scope="subtree">
      <arg-string>
       <token-substring length="1">
        <token-attr name="Given Name"/>
       </token-substring>
       <token-substring length="5">
        <token-attr name="Surname"/>
       </token-substring>
      </arg-string>
     </token-unique-name>
    </arg-value>
   </do-set-dest-attr-value>
  </actions>
 </rule>
</policy>

Father Ramon

<rule>
  <description>unique name sample</description>
  <conditions>
   <and>
    <if-class-name mode="nocase" op="equal">User</if-class-name>
   </and>
  </conditions>
  <actions>
   <do-set-op-dest-dn>
    <arg-dn>
     <token-unique-name counter-digits="2" counter-pattern="last" 
counter-use="fallback" name="cn" on-unavailable="error">
      <arg-string>
       <token-text>cn=</token-text>
       <token-substring length="1">
        <token-attr name="Given Name"/>
       </token-substring>
       <token-attr name="Surname"/>
       <token-text>,cn=Users,dc=novell,dc=com</token-text>
      </arg-string>
     </token-unique-name>
    </arg-dn>
   </do-set-op-dest-dn>
  </actions>
</rule>


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell