Novell is now a part of Micro Focus

Selecting User and Group Data

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 14 Oct 2004

Selecting User and Group Data for Processing

by Bill Valaski

Note: Thanks to reader Bill Valaski for this timely tip, complete with an XML example for reference.


When performing modifications to a user object, I wanted to limit the information passed on to the connected JDBC database. This limit would be based on Group membership.


I created a query that retrieves a list of the Groups that the user is a member of, and then performs a test to see if they're a member of a particular Group. If the User matches the Group I'm looking for, the query copies the XML information to the output document for further processing.

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="query cmd dncv" version="1.0"
xmlns:query="" xmlns:xsl="">

  <!-- parameters passed in from the DirXML engine -->

  <xsl:param name="srcQueryProcessor"/>
  <xsl:param name="destQueryProcessor"/>
  <xsl:param name="srcCommandProcessor"/>
  <xsl:param name="destCommandProcessor"/>
  <xsl:param name="dnConverter"/>
  <xsl:param name="fromNds"/>

  <!-- identity transformation template -->

  <!-- in the absence of any other templates this will cause -->
  <!-- the stylesheet to copy the input through unchanged to the output -->

  <xsl:template match="node()|@*">
      <xsl:apply-templates select="@*|node()"/>

  <!-- add your custom templates here -->

  <xsl:template match="*[@class-name='User']">
    <!-- Create a query for Group=TSMembers -->
    <xsl:variable name="query-doc">
      <query dest-dn="{@src-dn}" scope="entry">
        <read-attr attr-name="Group Membership"/>       </query>

  v<!-- Execute the query -->

    <xsl:variable name="result" select="query:query($srcQueryProcessor,$query-doc)"/>

    <!-- Test if the group matches, if it does, copy the operation for further processing -->

    <xsl:if test="$result//value[./text()='\CDS_TREE\CDS\CDS_Cincy\TSMembers']">
        <xsl:apply-templates select="@*|node()"/>

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

© Copyright Micro Focus or one of its affiliates