Generating Unique 8-Character CN’s

coolguys_netiq

By: coolguys_netiq

May 23, 2007 6:50 am

Reads: 155

Comments:0

Rating:0

Problem

A Forum reader recently asked:

“I’m using IDM 3.5 and looking for the best method to generate a CN value that includes:

  • A maximum length of 8 characters
  • The first character of the given name
  • The first character of the initials
  • The surname

The tie-breaker rule is to add a number to the end, and when adding a number to the end it must still be a maximum of 8 characters.”

And here’s the response from Father Ramon …

Solution

The example below will give you a 1-digit counter after an initial collision. If you want a counter even when no collision occurs, then get rid of the first pattern. If you want more than one digit, change the counter digits and adjust the substring length in the pattern to match.

<do-set-local-variable name="proposed" scope="policy">
   <arg-string>
     <token-substring length="8">
       <token-substring length="1">
         <token-attr name="Given Name"/>
       </token-substring>
       <token-substring length="1">
         <token-attr name="Inititials"/>
       </token-substring>
       <token-attr name="Surname"/>
     </token-substring>
   </arg-string>
</do-set-local-variable>
<do-set-op-dest-dn>
   <arg-dn>
     <token-unique-name counter-digits="1" counter-pattern="last" 
counter-use="always" name="CN" on-unavailable="error">
       <arg-string>
         <token-local-variable name="proposed"/>
       </arg-string>
       <arg-string>
         <token-substring length="7">
           <token-local-variable name="proposed"/>
         </token-substring>
       </arg-string>
     </token-unique-name>
   </arg-dn>
</do-set-op-dest-dn>

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags:
Categories: Identity Manager, Technical Solutions

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment