You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Simeon Walker <si...@sbs.bangor.ac.uk> on 2004/06/04 17:54:27 UTC

RoleFilterTransformer - is it broken or is it me?

Hi,

Whilst look for something to access request.isUserInRole I found the 
RoleFilterTransformer. It does not seem to be mentioned anywhere other 
than the Cocoon java api docs.

I have setup the transform acting on the output of SQL Transformer which 
produces a list of all possible role in our system. Here's a bit of the 
sitemap:

<map:match pattern="roles.xml">
  <map:generate src="cocoon://database/auth/ldap-roles.xml"/>
  <map:transform src="roles.xsl"/>
  <map:transform type="role-filter">
    <map:parameter name="element-name" value="dummy"/>
    <map:parameter name="count" value="100"/>
  </map:transform>
  <map:serialize type="xml"/>
</map:match>

The roles.xsl filter does the following to an SQL Tranformer rowset:

<xsl:template match="sql:rowset">
  <table>
    <xsl:for-each select="sql:row">
      <row roles:read-only="{sql:role_name}">
        <entry><xsl:value-of select="sql:role_name"/></entry>
      </row>
    </xsl:for-each>
  </table>
</xsl:template>

But this gives and odd result. The rows for the rows I possess have an 
attribute roles:read-only="" and rows for the roles I don't possess are 
passed through untouched! Surely this is not what's meant to happen?

If I try to use roles:restricted in the xsl above then I get a
java.util.EmptyStackException

Does anyone use this transformer? How did you get it to work?

Regards,
Simeon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: RoleFilterTransformer - is it broken or is it me?

Posted by Simeon Walker <si...@sbs.bangor.ac.uk>.
Joerg Heinicke wrote:

> On 04.06.2004 17:54, Simeon Walker wrote:
>
>> Hi,
>>
>> Whilst look for something to access request.isUserInRole I found the 
>> RoleFilterTransformer. It does not seem to be mentioned anywhere 
>> other than the Cocoon java api docs.
>
>
> Yeah, some features are treated really stepmotherly.
>
>> I have setup the transform acting on the output of SQL Transformer 
>> which produces a list of all possible role in our system. Here's a 
>> bit of the sitemap:
>>
>> <map:match pattern="roles.xml">
>>  <map:generate src="cocoon://database/auth/ldap-roles.xml"/>
>>  <map:transform src="roles.xsl"/>
>>  <map:transform type="role-filter">
>>    <map:parameter name="element-name" value="dummy"/>
>>    <map:parameter name="count" value="100"/>
>>  </map:transform>
>>  <map:serialize type="xml"/>
>> </map:match>
>>
>> The roles.xsl filter does the following to an SQL Tranformer rowset:
>>
>> <xsl:template match="sql:rowset">
>>  <table>
>>    <xsl:for-each select="sql:row">
>>      <row roles:read-only="{sql:role_name}">
>>        <entry><xsl:value-of select="sql:role_name"/></entry>
>>      </row>
>>    </xsl:for-each>
>>  </table>
>> </xsl:template>
>
>
> How does the XML output of the cocoon://database/auth/ldap-roles.xml 
> pipeline look like?
>
Like this, but I've ommitted many rows:

<rowset name="role-list">
  <row><role_name>Academic_Staff</role_name></row>
  <row><role_name>Administrative</role_name></row>
...
</rowset>

>> But this gives and odd result. The rows for the rows I possess have 
>> an attribute roles:read-only="" and rows for the roles I don't 
>> possess are passed through untouched! Surely this is not what's meant 
>> to happen?
>
>
> Can you be a bit more clear on this section?
>
After the RoleFilterTransformer it looks like this:

<table>
    <row roles:read-only=""><entry>Academic_Staff</entry></row>
    <row><entry>Administrative</entry></row>
</table>

The row for the role I actually have has the role:read-only="" 
attribute, rows for roles I don't have just get passwd through.

>> If I try to use roles:restricted in the xsl above then I get a
>> java.util.EmptyStackException
>
>
> Just by switching from roles:read-only to roles:restricted? Sounds 
> crazy and such crazy things point often to the endorsed libs problem:
> http://wiki.cocoondev.org/Wiki.jsp?page=EndorsedLibsProblem
> Make sure you are using the version of Xalan you expect as described 
> at http://xml.apache.org/xalan-j/faq.html#environmentcheck.
>
I have found that the filter produces malformed xml when the 
roles:restricted is used. The exeception was from the later html 
producing xsl transformation. Here's what it produces:

<table>
    <row><entry>Academic_Staff</entry></row><block id="1">
    <row><entry>Administrative</block></entry></row>
</table>

> Joerg
>
Thanks for you reply.

Regards,
Simeon

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: RoleFilterTransformer - is it broken or is it me?

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.06.2004 17:54, Simeon Walker wrote:

> Hi,
> 
> Whilst look for something to access request.isUserInRole I found the 
> RoleFilterTransformer. It does not seem to be mentioned anywhere other 
> than the Cocoon java api docs.

Yeah, some features are treated really stepmotherly.

> I have setup the transform acting on the output of SQL Transformer which 
> produces a list of all possible role in our system. Here's a bit of the 
> sitemap:
> 
> <map:match pattern="roles.xml">
>  <map:generate src="cocoon://database/auth/ldap-roles.xml"/>
>  <map:transform src="roles.xsl"/>
>  <map:transform type="role-filter">
>    <map:parameter name="element-name" value="dummy"/>
>    <map:parameter name="count" value="100"/>
>  </map:transform>
>  <map:serialize type="xml"/>
> </map:match>
> 
> The roles.xsl filter does the following to an SQL Tranformer rowset:
> 
> <xsl:template match="sql:rowset">
>  <table>
>    <xsl:for-each select="sql:row">
>      <row roles:read-only="{sql:role_name}">
>        <entry><xsl:value-of select="sql:role_name"/></entry>
>      </row>
>    </xsl:for-each>
>  </table>
> </xsl:template>

How does the XML output of the cocoon://database/auth/ldap-roles.xml 
pipeline look like?

> But this gives and odd result. The rows for the rows I possess have an 
> attribute roles:read-only="" and rows for the roles I don't possess are 
> passed through untouched! Surely this is not what's meant to happen?

Can you be a bit more clear on this section?

> If I try to use roles:restricted in the xsl above then I get a
> java.util.EmptyStackException

Just by switching from roles:read-only to roles:restricted? Sounds crazy 
and such crazy things point often to the endorsed libs problem:
http://wiki.cocoondev.org/Wiki.jsp?page=EndorsedLibsProblem
Make sure you are using the version of Xalan you expect as described at 
http://xml.apache.org/xalan-j/faq.html#environmentcheck.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org