Novell Home

Detecting User-Driver Associations

Novell Cool Solutions: Tip
By Lothar Haeger

Digg This - Slashdot This

Posted: 20 Sep 2006
 

Problem

A Forum reader asked this question:

"Does anyone know how I can check to see if a user is associated with another driver in the IDM Tree?"

And here's a suggestion from Lothar Haegar ...

Solution

Here's one way to do it:

<?xml version="1.0" encoding="UTF-8"?>
<policy xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor">
  <rule>
    <description>Check If Associated: set up variables</description>
      <conditions>
        <and>
          <if-class-name mode="nocase" op="equal">User</if-class-name>
          <if-xpath op="true">@src-dn</if-xpath>
        </and>
      </conditions>
    <actions>
      <do-set-local-variable name="check-dn">
        <arg-string>
          <token-dest-dn/>
        </arg-string>
      </do-set-local-variable>
      <do-set-local-variable name="check-drv-name">
        <arg-string>
          <token-text xml:space="preserve">admin\Driverset\ZK_GUIDs</token-text>
        </arg-string>
      </do-set-local-variable>
      <do-set-local-variable name="check-drv-state">
        <arg-string>
          <token-xpath expression='query:readObject($srcQueryProcessor, "",$check-dn,"","DirXML-Associations")/attr/value[contains(component[@name=
3D"volume"],$check-drv-name)]/component[@name="nameSpace"]'/>
        </arg-string>
      </do-set-local-variable>
      <do-trace-message disabled="true">
        <arg-string>
          <token-text xml:space="preserve">Valid DirXML association states: 1=processed, 2=pending, 3=manual, 4=migrate, all other values=disabled</token-text>
        </arg-string>
      </do-trace-message>
    </actions>
  </rule>
  <rule>
    <description>Check If Associated: Match!</description>
      <conditions>
        <and>
          <if-local-variable mode="numeric" name="check-drv-state" op="equal">1</if-local-variable>
        </and>
      </conditions>
    <actions>
      <do-trace-message color="brgreen">
        <arg-string>
          <token-text xml:space="preserve">Bingo! Object </token-text>
          <token-local-variable name="check-dn"/>
          <token-text xml:space="preserve"> is associated with state                   
          </token-text>
          <token-local-variable name="check-drv-state"/>
          <token-text xml:space="preserve"> for driver </token-text>
          <token-local-variable name="check-drv-name"/>
        </arg-string>
      </do-trace-message>
    </actions>
  </rule>
  <rule>
    <description>Check If Associated: NO Match!</description>
      <conditions>
        <and>
          <if-local-variable mode="nocase" name="check-drv-state" op="not-equal">1</if-local-variable>
        </and>
      </conditions>
    <actions>
      <do-trace-message color="brred">
        <arg-string>
          <token-text xml:space="preserve">Bongo! Object </token-text>
          <token-local-variable name="check-dn"/>
          <token-text xml:space="preserve"> is NOT associated with state  
          </token-text>
          <token-local-variable name="check-drv-state"/>
          <token-text xml:space="preserve"> for driver </token-text>
          <token-local-variable name="check-drv-name"/>
        </arg-string>
      </do-trace-message>
    </actions>
  </rule>
</policy>


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

© 2014 Novell