Article

lhaeger's picture
article
Reads:

5070

Score:
0
0
 
Comments:

0

Detecting User-Driver Associations

Author Info

20 September 2006 - 2:56am
Submitted by: lhaeger

(View Disclaimer)

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>


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

© 2013 Novell