Hi all

Im using idm 3.01 with an authentication tree idvault connected to a
mysql 4 datatbase. My problem is that that i cannot call stored
procedures from the driver as it is only version 4 and stored procedures
and triggers are not supported.

Therefore I am trying to use a style sheet to do the following:

When a group is added to a user the style sheet should add the
sourcename() of the group added plus the cn of the user to a table which
isnt schema matched.

I have idm working so that users get added to groups in the LDAP tree,
when they are added or removed from groups i need to do an insert for an
add and a delete on a remove.

The problems i am having is that is being funny about the xsl:when
location and also it wont read the CN from the object. Dont think the
'when' statement ever becomes true, what it is supposed to do is become
true if there is a value in group membership removed, ie when it has
been deleted. Any ideas?

--------------------------------------------------------------------------------------------------
<Xxml version="1.0" encoding="UTF-8"?><xsl:stylesheet
exclude-result-prefixes="query cmd dncv" version="1.0"
xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor"
xmlns:dncv="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.DNConverter"
xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><!-- parameters passed
in from the DirXML engine -->
<xslaram name="srcQueryProcessor"/>
<xslaram name="destQueryProcessor"/>
<xslaram name="srcCommandProcessor"/>
<xslaram name="destCommandProcessor"/>
<xslaram name="dnConverter"/>
<xslaram 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:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- add your custom templates here -->
<xsl:template match="modify[@class-name='User']"
xmlns:jdbc="urn:dirxml:jdbc">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<xsl:variable name="CN"
select="*[@attr-name='CN']/value[1]"/>
<xsl:variable name="GroupMem"
select="modify-attr[@attr-name='Group Membership']/add-value/value"/>
<xsl:message>Starting: Add Student to course</xsl:message>
<!-- <xsl:variable name = "test"/> -->
<xsl:choose>
<xsl:when test="modify-attr[@attr-name=’Group Membership’]/remove-value">
<jdbc:statement jdbc:type="update">
<association>
<xsl:value-of select="/nds/input/*/association"/>
</association>
<jdbc:sql>
<xsl:text>DELETE FROM mdl_role_assignments </xsl:text>
<xsl:text>WHERE userid = </xsl:text>
<xsl:value-of select="$CN"/>
<xsl:text>AND contextidlevel = </xsl:text>
<xsl:value-of select="$GroupMem"/>
</jdbc:sql>
</jdbc:statement>
</xsl:when>
<xsltherwise>
<jdbc:statement jdbc:type="update">
<association>
<xsl:value-of select="/nds/input/*/association"/>
</association>
<jdbc:sql>
<xsl:text>INSERT INTO mdl_role_assignments</xsl:text>
<xsl:text>(roleid, userid, contextidlevel)</xsl:text>
<xsl:text>VALUES (3,</xsl:text>
<xsl:value-of select="$CN"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$GroupMem"/>
<xsl:text>)</xsl:text>
</jdbc:sql>
</jdbc:statement>
</xsltherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


--------------------------------------------------------------------------------------------------------



Thanks in advance