Article

coolguys's picture
article
Reads:

5927

Score:
2.25
2.3
4
 
Comments:

1

IDM Token-Unique-Name Examples

Author Info

24 October 2007 - 4:17am
Submitted by: coolguys

(View Disclaimer)

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>

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

iammi's picture

How about custom IDM Token-Unique-Name?

Submitted by iammi on 15 December 2009 - 6:06am.

Hello!

How about custom IDM Token-Unique-Name?

I mean I would like to implement this algortithm

unique_name = Surname+ "-" +Substring(1, GivenName)

exmaple : if (givenName,Surname)=(Ismail, AMMI) --> unique_name = AMMI-I

if name already exists we will substring 2 positions, if substring take 3...

example if (givenName,Surname)=(Imad, AMMI) --> unique_name = AMMI-IM

And so forth

The mechaniqme provided by IDM out of the box is incremental. how to implement this algorithm

Please reply

© 2013 Novell