I would like to replace a modify event on an attribute of an OU with
modify events of all contained Users.
I extended the Schema with an auxClass "quota" with two optional
attributes: quotaHome, quotaProfile (both integer). I add this class to an
OU to define default values for users. I this class to an User if I want
to override the default values:
OU Users
attr Users.quotaHome = 512
USER Users.joe
USER Users.max
attr Users.max.quotaHome = 1024
meaning joe would get a quota of 512 on his home drive, whereas max would
get 1014.
The query/override logic is implemented in a delimited text driver
(see Subject: Delimited Test Driver and ou attributes.)
Now if I change the quotaHomeattribute on the Users OU, I'd like to act as
if all Users beneath the OU were changed. Thus I can use my already
implemented default query logic.
This is what I added to my Transform rule:
<xsl:template match="modify[@class-name='Organizational Unit']">
<xsl:variable name="query">
<nds dtdversion="1.0" ndsversion="8.5">
<input>
<query class-name="User" dest-dn="{@src-dn}" scopy="subtree">
<search-class class-name="User"/>
<read-attr attr-name="uniqueID"/>
<read-attr attr-name="quotaHome"/>
<read-attr attr-name="quotaProfile"/>
</query>
</input>
</nds>
</xsl:variable>
<xsl:variable name="result" select="query:query($srcQueryProcessor,$query)"/>
<xsl:for-each select="$result/nds/output/instance">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
which results in something like this:
<instance class-name="User" src-dn="\mytree\Users\svoelke" src-entry-id="36060">
<attr attr-name="uniqueID">
<value timestamp="1073571850#3" type="string">svoelke</value>
</attr>
<attr attr-name="quotaHome">
<value timestamp="1074779719#2" type="int">513</value>
</attr>
</instance>
But I am not sure on how to go on further from this. How do I create
modify events from the returned <output> document and apply my existing
default query template?
Thanks in advance
Stefan
> Hello,
>
> I would like to replace a modify event on an attribute of an OU with
> modify events of all contained Users.
After realizing that the output rule matches <instance>, not <modify> I
found that this sniplet does the trick:
<xsl:template match="modify[@class-name='Organizational Unit']">
<xsl:variable name="query">
<nds dtdversion="1.0" ndsversion="8.5">
<input>
<query class-name="User" dest-dn="{@src-dn}" scope="subtree">
<search-class class-name="User"/>
<read-attr attr-name="uniqueID"/>
<read-attr attr-name="quotaHome"/>
<read-attr attr-name="quotaProfile"/>
</query>
</input>
</nds>
</xsl:variable>
<xsl:variable name="result" select="query:query($srcQueryProcessor,$query)"/>
<xsl:copy-of select="$result//instance"/>
</xsl:template>
Stefan