cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/samples/slide AdminHelper.java
Date Mon, 12 Jan 2004 17:10:33 GMT
unico       2004/01/12 09:10:33

  Modified:    src/blocks/slide/samples/styles permissions2html.xsl
               src/blocks/slide/samples/screens permissions.jx users.jx
                        roles.jx groups.jx
               src/blocks/slide/samples sitemap.xmap flow.js
               src/blocks/slide/java/org/apache/cocoon/samples/slide
                        AdminHelper.java
  Added:       src/blocks/slide/samples/styles content2html.xsl
                        properties2html.xsl layout.xsl locks2html.xsl
                        users2html.xsl
               src/blocks/slide/samples/screens login.jx privileges.jx
                        locks.jx
  Removed:     src/blocks/slide/samples/styles description2html4content.xsl
                        description2html4locks.xsl
                        description2html4users.xsl
                        description2html4properties.xsl
               src/blocks/slide/samples/screens login-failed.xml logout.xml
                        authentication.jx login.xml actions.jx
  Log:
  reworking slide administration samples for Slide ACL using Cocoon flow
  
  Revision  Changes    Path
  1.2       +31 -65    cocoon-2.1/src/blocks/slide/samples/styles/permissions2html.xsl
  
  Index: permissions2html.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/styles/permissions2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- permissions2html.xsl	14 Dec 2003 15:29:16 -0000	1.1
  +++ permissions2html.xsl	12 Jan 2004 17:10:33 -0000	1.2
  @@ -2,63 +2,21 @@
   <xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:col="http://apache.org/cocoon/collection/1.0" 
  -  xmlns:dav="DAV:" 
     version="1.0">
   
  +  <xsl:import href="layout.xsl"/>
     <xsl:output indent="yes"/>
  -  <xsl:param name="base">/samples/slide</xsl:param>
  -  <xsl:param name="path" />
     
  -  <xsl:template match="/">
  -    <document>
  -      <header>
  -        <title>Jakarta Slide example</title>
  -        <tab title="users" href="{$base}/users/"/>
  -        <tab title="content" href="{$base}/content/{$path}"/>
  -        <tab title="properties" href="{$base}/properties/{$path}"/>
  -        <tab title="permissions" href="{$base}/permissions/{$path}"/>
  -        <tab title="locks" href="{$base}/locks/{$path}"/>
  -        <tab title="logout" href="{$base}/logout.html"/>
  -      </header>
  -      <body>
  -        <row>
  -          <xsl:apply-templates select="/document/col:collection|/document/col:resource"/>
  -        </row>
  -      </body>
  -    </document>
  -  </xsl:template>
  -
  -  <xsl:template match="col:collection|col:resource">
  -    <column title="Navigation">
  -      <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
  -        <tr>
  -          <td width="100%" bgcolor="#ffffff" align="left">
  -            <br/>
  -          </td>
  -        </tr>
  -        <xsl:for-each select="col:collection|col:resource">
  -          <tr>
  -            <td width="100%" bgcolor="#ffffff" align="left">
  -              <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  -                <xsl:choose>
  -                  <xsl:when test="$path = ''">
  -	                <a href="{$base}/permissions/{@name}">
  -	                  <xsl:value-of select="@name"/>
  -	                </a>
  -                  </xsl:when>
  -                  <xsl:otherwise>
  -	                <a href="{$base}/permissions/{$path}/{@name}">
  -	                  <xsl:value-of select="@name"/>
  -	                </a>
  -                  </xsl:otherwise>
  -                </xsl:choose>
  -              </font>
  -            </td>
  -          </tr>
  -        </xsl:for-each>
  -      </table>
  -    </column>
  +  <xsl:param name="base"/>
  +  <xsl:param name="path"/>
  +  <xsl:param name="type">permissions</xsl:param>
   
  +  <xsl:param name="userspath"/>
  +  <xsl:param name="rolespath"/>
  +  <xsl:param name="groupspath"/>
  +  <xsl:param name="actionspath"/>
  +  
  +  <xsl:template name="middle">
       <column title="Permissions">
         <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
           <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  @@ -83,7 +41,7 @@
                   <xsl:value-of select="subject"/>
                 </td>
                 <td align="left">
  -                <xsl:value-of select="action"/>
  +                <xsl:value-of select="privilege"/>
                 </td>
                 <td align="left">
                   <xsl:value-of select="inheritable"/>
  @@ -92,10 +50,10 @@
                   <xsl:value-of select="negative"/>
                 </td>
                 <td align="right">
  -                <form action="{$base}/removePermission.do" method="post">
  +                <form action="{$base}/removePermission" method="post">
                     <input type="hidden" name="resourcePath" value="{$path}"/>
                     <input type="hidden" name="subject" value="{subject}"/>
  -                  <input type="hidden" name="action" value="{action}"/>
  +                  <input type="hidden" name="privilege" value="{privilege}"/>
                     <input type="hidden" name="inheritable" value="{inheritable}"/>
                     <input type="hidden" name="negative" value="{negative}"/>
                     <input type="submit" name="doRemovePermission" value="Delete"/>
  @@ -104,7 +62,7 @@
               </tr>
             </xsl:for-each>
             <tr>
  -            <form action="{$base}/addPermission.do" method="post">
  +            <form action="{$base}/addPermission" method="post">
                 <input type="hidden" name="resourcePath" value="{$path}"/>
                 <td align="left">
                   <select name="subject">
  @@ -114,18 +72,24 @@
                     <option>unauthenticated</option>
                     <option>all</option>
                     <xsl:for-each select="/document/roles/role">
  -                    <option>
  -                      <xsl:value-of select="name"/>
  +                    <xsl:variable name="roleuri" select="uri/text()" />
  +                    <xsl:variable name="rolename" select="substring-after($roleuri,concat($rolespath,'/'))"/>
  +                    <option value="{$roleuri}">
  +                      role: <xsl:value-of select="$rolename"/>
                       </option>
                     </xsl:for-each>
                     <xsl:for-each select="/document/users/user">
  -                    <option>
  -                      <xsl:value-of select="name"/>
  +                    <xsl:variable name="useruri" select="uri/text()" />
  +                    <xsl:variable name="username" select="substring-after($useruri,concat($userspath,'/'))"/>
  +                    <option value="{$useruri}">
  +                      user: <xsl:value-of select="$username"/>
                       </option>
                     </xsl:for-each>
                     <xsl:for-each select="/document/groups/group">
  -                    <option>
  -                      <xsl:value-of select="name"/>
  +                    <xsl:variable name="groupuri" select="uri/text()" />
  +                    <xsl:variable name="groupname" select="substring-after($groupuri,concat($groupspath,'/'))"/>
  +                    <option value="{$groupuri}">
  +                      group: <xsl:value-of select="$groupname"/>
                       </option>
                     </xsl:for-each>
                   </select>
  @@ -134,9 +98,11 @@
                   <select name="action">
                     <option>all</option>
                     <option>default</option>
  -                  <xsl:for-each select="/document/actions/action">
  -                    <option>
  -                      <xsl:value-of select="name"/>
  +                  <xsl:for-each select="/document/privileges/privilege">
  +                    <xsl:variable name="actionuri" select="uri/text()" />
  +                    <xsl:variable name="actionname" select="substring-after($actionuri,concat($actionspath,'/'))"/>
  +                    <option value="{$actionuri}">
  +                      <xsl:value-of select="$actionname"/>
                       </option>
                     </xsl:for-each>
                   </select>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/styles/content2html.xsl
  
  Index: content2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:col="http://apache.org/cocoon/collection/1.0" 
    xmlns:xi="http://www.w3.org/2001/XInclude" 
    version="1.0">
  
    <xsl:import href="layout.xsl" />
    <xsl:output indent="yes"/>
    
    <xsl:param name="base"/>
    <xsl:param name="path"/>
    
    <xsl:param name="namespace"/>
    <xsl:param name="principal"/>
  
    <xsl:param name="type">content</xsl:param>
    
    <xsl:template name="middle">
      <column title="Content">
        <xsl:apply-templates select="/document/col:resource|/document/col:collection" />
      </column>
    </xsl:template>
    
    <xsl:template match="col:resource|col:collection">
      <xsl:choose>
        <xsl:when test="local-name() = 'collection'">
          <table width="100%" cellspacing="0" cellpadding="5" align="center">
            <font size="+1" face="arial,helvetica,sanserif" color="#000000">
              <tr>
                <td align="left">
                  <b>Filename</b>
                </td>
                <td align="left">
                  <b>Type</b>
                </td>
                <td align="left">
                  <b>Size</b>
                </td>
                <td align="left">
                  <b>Last Modified</b>
                </td>
                <td align="right"/>
              </tr>
              <xsl:for-each select="col:collection|col:resource">
                <tr>
                  <td align="left">&#xA0;&#xA0;
                    <a href="{@name}"><xsl:value-of select="@name"/></a>
                  </td>
                  <td align="left">
                    <xsl:value-of select="@mime-type"/>
                  </td>
                  <td align="left">
                    <xsl:value-of select="@contentlength"/>
                  </td>
                  <td align="left">
                    <xsl:value-of select="@date"/>
                  </td>
                  <td align="right">
                    <form action="{$base}/delete" method="post">
                      <input type="hidden" name="parentPath" value="{$path}" />
                      <input type="hidden" name="resourceName" value="{@name}"/>
                      <input type="submit" name="doDeleteSource" value="Delete"/>
                    </form>
                  </td>
                </tr>
              </xsl:for-each>
              <tr>
                <form action="{$base}/upload" method="post" enctype="multipart/form-data">
                  <input type="hidden" name="parentPath" value="{$path}"/>
                  <td align="left"><input type="text" name="resourceName" size="15" maxlength="40"/></td>
                  <td align="left" colspan="3">
                   File:
                   <input type="file" name="uploadFile" size="15" maxlength="40"/>
                  </td>
                  <td align="right">
                    <input type="submit" name="doUploadSource" value="Upload File"/>
                  </td>
                </form>
              </tr>
              <tr>
                <form action="{$base}/mkcol" method="post">
                  <input type="hidden" name="parentPath" value="{$path}"/>
                  <td align="left" colspan="4">
                    <input type="text" name="collectionName" size="15" maxlength="40"/>
                  </td>
                  <td align="right">
                    <input type="submit" name="doCreateCollection" value="Create collection"/>
                  </td>
                </form>
              </tr>
            </font>
          </table>
        </xsl:when>
        <xsl:when test="@mime-type='image/gif'">
          <img src="../view/{$path}"/>
        </xsl:when>
        <xsl:when test="@mime-type='image/jpeg'">
          <img src="../view/{$path}"/>
        </xsl:when>
        <xsl:when test="@mime-type='text/plain'">
          <pre>
            <xi:include href="slide://{$principal}@{$namespace}/{$path}" parse="text"/>
          </pre>
        </xsl:when>
        <xsl:when test="@mime-type='text/xml'">
          <pre>
            <xi:include href="slide://{$principal}@{$namespace}/{$path}" parse="text"/>
          </pre>
        </xsl:when>
        <xsl:otherwise>
          <h3>Could not display content.</h3>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/styles/properties2html.xsl
  
  Index: properties2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:col="http://apache.org/cocoon/collection/1.0" 
    xmlns:DAV="DAV:"
    version="1.0">
  
    <xsl:import href="layout.xsl" />
    <xsl:output indent="yes"/>
    
    <xsl:param name="base"/>
    <xsl:param name="path"/>
    
    <xsl:param name="type">properties</xsl:param>
  
    <xsl:template name="middle">
      <column title="Properties">
        <xsl:apply-templates select="/document/col:resource|/document/col:collection" />
      </column>
    </xsl:template>
  
    <xsl:template match="col:resource|col:collection">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
          <font size="+1" face="arial,helvetica,sanserif" color="#000000">
            <tr>
              <td align="left">
                <b>Namespace</b>
              </td>
              <td align="left">
                <b>Name</b>
              </td>
              <td align="left">
                <b>Value</b>
              </td>
              <td align="right"/>
            </tr>
            <xsl:for-each select="col:properties/child::node()">
              <tr>
                <td align="left">
                  <xsl:value-of select="namespace-uri(.)"/>
                </td>
                <td align="left">
                  <xsl:value-of select="local-name(.)"/>
                </td>
                <td align="left">
                  <xsl:value-of select="."/>
                </td>
                <td align="right">
                  <xsl:if test="namespace-uri()!='DAV:'">
                    <form action="{$base}/removeproperty" method="post">
                      <input type="hidden" name="resourcePath" value="{$path}"/>
                      <input type="hidden" name="namespace" value="{namespace-uri()}"/>
                      <input type="hidden" name="name" value="{local-name()}"/>
                      <input type="submit" name="doDeleteProperty" value="Delete"/>
                    </form>
                  </xsl:if>
                </td>
              </tr>
            </xsl:for-each>
            <tr>
              <form action="{$base}/addproperty" method="post">
                <input type="hidden" name="resourcePath" value="{$path}"/>
                <td align="left">
                  <input name="namespace" type="text" size="15" maxlength="40"/>
                </td>
                <td align="left">
                  <input name="name" type="text" size="15" maxlength="40"/>
                </td>
                <td align="left">
                  <input name="value" type="text" size="15" maxlength="40"/>
                </td>
                <td align="right">
                  <input type="submit" name="doAddProperty" value="Add/Modify"/>
                </td>
              </form>
            </tr>
          </font>
        </table>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/styles/layout.xsl
  
  Index: layout.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:col="http://apache.org/cocoon/collection/1.0" 
    version="1.0">
    
    <xsl:output indent="yes"/>
    
    <xsl:param name="base"/>
    <xsl:param name="path"/>
    <xsl:param name="type"/>
    
    <xsl:template match="/">
      <document>
        <header>
          <title>Jakarta Slide example</title>
          <tab title="users" href="{$base}/users"/>
          <tab title="content" href="{$base}/content/{$path}"/>
          <tab title="properties" href="{$base}/properties/{$path}"/>
          <tab title="permissions" href="{$base}/permissions/{$path}"/>
          <tab title="locks" href="{$base}/locks/{$path}"/>
          <tab title="logout" href="{$base}/logout"/>
        </header>
        <body>
          <xsl:call-template name="body" />
        </body>
      </document>
    </xsl:template>
    
    <xsl:template name="body">
      <row>
        <xsl:call-template name="left" />
        <xsl:call-template name="middle" />
      </row>
    </xsl:template>
    
    <xsl:template name="left">
      <column title="Navigation">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
          <tr>
            <td width="100%" bgcolor="#ffffff" align="left">
              <br/>
            </td>
          </tr>
          <xsl:for-each select="/document/col:collection/col:resource|/document/col:collection/col:collection">
            <tr>
              <td width="100%" bgcolor="#ffffff" align="left">
                <font size="+0" face="arial,helvetica,sanserif" color="#000000">
                  <xsl:choose>
                    <xsl:when test="$path != ''">
                      <a href="{$base}/{$type}/{$path}/{@name}">
                        <xsl:value-of select="@name"/>
                      </a>
                    </xsl:when>
                    <xsl:otherwise>
                      <a href="{$base}/{$type}/{@name}">
                        <xsl:value-of select="@name"/>
                      </a>
                    </xsl:otherwise>
                  </xsl:choose>
                </font>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </column>
    </xsl:template>
  
    <xsl:template name="middle">
    </xsl:template>
    
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/styles/locks2html.xsl
  
  Index: locks2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:col="http://apache.org/cocoon/collection/1.0" 
    version="1.0">
    
    <xsl:import href="layout.xsl" />
    <xsl:output indent="yes"/>
    
    <xsl:param name="base"/>
    <xsl:param name="path"/>
    <xsl:param name="type">locks</xsl:param>
    
    <xsl:template name="middle">
      <column title="Locks">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
          <font size="+0" face="arial,helvetica,sanserif" color="#000000">
            <tr>
              <td align="left">
                <b>Subject</b>
              </td>
              <td align="left">
                <b>Type</b>
              </td>
              <td align="left">
                <b>Expiration</b>
              </td>
              <td align="left">
                <b>Inheritable</b>
              </td>
              <td align="left">
                <b>Exclusive</b>
              </td>
              <td align="right"/>
            </tr>
            <xsl:for-each select="/document/locks/lock">
              <tr bgcolor="#eeeeee">
                <td align="left">
                  <xsl:value-of select="subject"/>
                </td>
                <td align="left">
                  <xsl:value-of select="type"/>
                </td>
                <td align="left">
                  <xsl:value-of select="expiration"/>
                </td>
                <td align="left">
                  <xsl:value-of select="inheritable"/>
                </td>
                <td align="left">
                  <xsl:value-of select="exclusive"/>
                </td>
                <td align="right">
                  <form action="{$base}/removelock" method="post">
                    <input type="hidden" name="resourcePath" value="{$path}"/>
                    <input type="hidden" name="objectUri" value="{object}"/>
                    <input type="hidden" name="lockId" value="{id}"/>
                    <input type="submit" name="doRemoveLock" value="Delete"/>
                  </form>
                </td>
              </tr>
            </xsl:for-each>
            <tr>
              <form action="{$base}/addlock" method="post">
                <input type="hidden" name="resourcePath" value="{$path}"/>
                <td align="left">
                  <input name="subject" type="text" size="20" maxlength="40"/>
                </td>
                <td align="left">
                  <input name="type" type="text" size="15" maxlength="40"/>
                </td>
                <td align="left">
                  <input name="expiration" type="text" size="15" maxlength="40"/>
                </td>
                <td align="left">
                  <select name="inheritable">
                    <option>false</option>
                    <option>true</option>
                  </select>
                </td>
                <td align="left">
                  <select name="exclusive">
                    <option>false</option>
                    <option>true</option>
                  </select>
                </td>
                <td align="right">
                  <input type="submit" name="doAddLock" value="Add/Modify"/>
                </td>
              </form>
            </tr>
          </font>
        </table>
      </column>
    </xsl:template>
    
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/styles/users2html.xsl
  
  Index: users2html.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:col="http://apache.org/cocoon/collection/1.0" 
    xmlns:dav="DAV:" 
    version="1.0">
    
    <xsl:import href="layout.xsl" />
    <xsl:output indent="yes"/>
    
    <xsl:param name="base"/>
    
    <xsl:param name="userspath"/>
    <xsl:param name="rolespath"/>
    <xsl:param name="groupspath"/>
    
    <xsl:template name="body">
      <row>
        <xsl:call-template name="top" />
      </row>
      <row>
        <xsl:call-template name="bottom" />
      </row>
    </xsl:template>
    
    <xsl:template name="top">
      <xsl:apply-templates select="/document/users"/>
    </xsl:template>
    
    <xsl:template name="bottom">
      <xsl:apply-templates select="/document/groups"/>
    </xsl:template>
  
    <xsl:template match="/document/users">
      <column title="Users">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
          <font size="+0" face="arial,helvetica,sanserif" color="#000000">
            <tr>
              <td align="left">
                <b>User</b>
              </td>
              <td align="left"/>
              <td align="left">
                <b>Roles</b>
              </td>
              <td align="left"/>
              <td align="left">
                <b>Groups</b>
              </td>
              <td align="left"/>
              <td align="right"/>
            </tr>
            <xsl:for-each select="user">
              <xsl:variable name="useruri"  select="uri/text()" />
              <xsl:variable name="username" select="substring-after($useruri,concat($userspath,'/'))" />
              <tr>
                <form action="{$base}/removeobject" method="post">
                  <input type="hidden" name="objecturi" value="{$useruri}"/>
                  <td align="left">
                    <xsl:value-of select="$username"/>
                  </td>
                  <td align="left">
                    <input type="submit" name="doRemoveUser" value="Delete user"/>
                  </td>
                </form>
                <form action="{$base}/removemember" method="post">
                  <input type="hidden" name="subjecturi" value="{$useruri}"/>
                  <td align="left">
                    <select name="objecturi">
                      <xsl:for-each select="/document/roles/role[member=$useruri]">
                        <xsl:variable name="roleuri" select="uri/text()" />
                        <xsl:variable name="rolename" select="substring-after($roleuri,concat($rolespath,'/'))" />
                        <option value="{$roleuri}">
                          <xsl:value-of select="$rolename"/>
                        </option>
                      </xsl:for-each>
                    </select>
                  </td>
                  <td align="left">
                    <input type="submit" name="doRemoveRoleMember" value="Remove role"/>
                  </td>
                </form>
                <form action="{$base}/removemember" method="post">
                  <input type="hidden" name="subjecturi" value="{$useruri}"/>
                  <td align="left">
                    <select name="objecturi">
                      <xsl:for-each select="/document/groups/group[member=$useruri]">
                        <xsl:variable name="groupuri" select="uri/text()" />
                        <xsl:variable name="groupname" select="substring-after($groupuri,concat($groupspath,'/'))" />
                        <option value="{$groupuri}">
                          <xsl:value-of select="$groupname"/>
                        </option>
                      </xsl:for-each>
                    </select>
                  </td>
                  <td align="left">
                    <input type="submit" name="doRemoveGroupMember" value="Remove group"/>
                  </td>
                </form>
              </tr>
              <tr>
                <td align="left"/>
                <td align="left"/>
                <form action="{$base}/addmember" method="post">
                  <input type="hidden" name="subjecturi" value="{$useruri}"/>
                  <td align="left">
                    <select name="objecturi" size="1">
                      <xsl:for-each select="/document/roles/role">
                        <xsl:variable name="roleuri" select="uri/text()"/>
                        <xsl:variable name="rolename" select="substring-after($roleuri,concat($rolespath,'/'))"/>
                        <option value="{$roleuri}">
                          <xsl:value-of select="$rolename"/>
                        </option>
                      </xsl:for-each>
                    </select>
                  </td>
                  <td align="left">
                    <input type="submit" name="doAddRoleMember" value="Add role"/>
                  </td>
                </form>
                <form action="{$base}/addmember" method="post">
                  <input type="hidden" name="subjecturi" value="{$useruri}"/>
                  <td align="left">
                    <select name="objecturi" size="1">
                      <xsl:for-each select="/document/groups/group">
                        <xsl:variable name="groupuri" select="uri/text()"/>
                        <xsl:variable name="groupname" select="substring-after($groupuri,concat($groupspath,'/'))"/>
                        <option value="{$groupuri}">
                          <xsl:value-of select="$groupname"/>
                        </option>
                      </xsl:for-each>
                    </select>
                  </td>
                  <td align="left">
                    <input type="submit" name="doAddGroupMember" value="Add group"/>
                  </td>
                </form>
              </tr>
            </xsl:for-each>
            <tr>
              <form action="{$base}/adduser" method="post">
                <td align="left">
                  <input name="username" type="text" size="10" maxlength="40"/>
                </td>
                <td align="left">
                  <input name="password" type="password" size="10" maxlength="40"/>
                </td>
                <td align="left"/>
                <td align="left"/>
                <td align="left"/>
                <td align="right">
                  <input type="submit" name="doAddUser" value="Add user"/>
                </td>
              </form>
            </tr>
          </font>
        </table>
      </column>
    </xsl:template>
      
    <xsl:template match="/document/groups">
      <column title="Groups">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
          <font size="+0" face="arial,helvetica,sanserif" color="#000000">
            <tr>
              <td align="left">
                <b>Group</b>
              </td>
              <td align="right"/>
            </tr>
            <xsl:for-each select="group">
              <xsl:variable name="groupuri"  select="uri/text()" />
              <xsl:variable name="groupname" select="substring-after($groupuri,concat($groupspath,'/'))" />
              <tr>
                <form action="{$base}/removeobject" method="post">
                  <input type="hidden" name="objecturi" value="{$groupuri}"/>
                  <td align="left">
                    <xsl:value-of select="$groupname"/>
                  </td>
                  <td align="right">
                    <input type="submit" name="doRemovePrincipalGroup" value="Delete group"/>
                  </td>
                </form>
              </tr>
            </xsl:for-each>
            <tr>
              <form action="{$base}/addgroup" method="post">
                <td align="left">
                  <input name="groupname" type="text" size="15" maxlength="40"/>
                </td>
                <td align="right">
                  <input type="submit" name="doAddPrincipalGroup" value="Add group"/>
                </td>
              </form>
            </tr>
          </font>
        </table>
      </column>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.2       +1 -1      cocoon-2.1/src/blocks/slide/samples/screens/permissions.jx
  
  Index: permissions.jx
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/screens/permissions.jx,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- permissions.jx	14 Dec 2003 15:29:15 -0000	1.1
  +++ permissions.jx	12 Jan 2004 17:10:33 -0000	1.2
  @@ -2,7 +2,7 @@
   <permissions xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
     <jx:forEach var="permission" items="${permissions}">
       <permission>
  -      <action>${permission.actionUri}</action>
  +      <privilege>${permission.actionUri}</privilege>
         <object>${permission.objectUri}</object>
         <subject>${permission.subjectUri}</subject>
         <inheritable>${permission.inheritable}</inheritable>
  
  
  
  1.2       +1 -1      cocoon-2.1/src/blocks/slide/samples/screens/users.jx
  
  Index: users.jx
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/screens/users.jx,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- users.jx	14 Dec 2003 15:29:15 -0000	1.1
  +++ users.jx	12 Jan 2004 17:10:33 -0000	1.2
  @@ -2,7 +2,7 @@
   <users xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
     <jx:forEach var="user" items="${users}">
       <user>
  -      <name>${user}</name>
  +      <uri>${user}</uri>
       </user>
     </jx:forEach>
   </users>
  
  
  
  1.2       +4 -1      cocoon-2.1/src/blocks/slide/samples/screens/roles.jx
  
  Index: roles.jx
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/screens/roles.jx,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- roles.jx	14 Dec 2003 15:29:15 -0000	1.1
  +++ roles.jx	12 Jan 2004 17:10:33 -0000	1.2
  @@ -2,7 +2,10 @@
   <roles xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
     <jx:forEach var="role" items="${roles}">
       <role>
  -      <name>${role}</name>
  +      <uri>${role.uri}</uri>
  +      <jx:forEach var="member" items="${role.members}">
  +        <member>${member}</member>
  +      </jx:forEach>
       </role>
     </jx:forEach>
   </roles>
  
  
  
  1.2       +4 -1      cocoon-2.1/src/blocks/slide/samples/screens/groups.jx
  
  Index: groups.jx
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/screens/groups.jx,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- groups.jx	14 Dec 2003 15:29:15 -0000	1.1
  +++ groups.jx	12 Jan 2004 17:10:33 -0000	1.2
  @@ -2,7 +2,10 @@
   <groups xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
     <jx:forEach var="group" items="${groups}">
       <group>
  -      <name>${group}</name>
  +      <uri>${group.uri}</uri>
  +      <jx:forEach var="member" items="${group.members}">
  +        <member>${member}</member>
  +      </jx:forEach>
       </group>
     </jx:forEach>
   </groups>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/screens/login.jx
  
  Index: login.jx
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <header>
      <title>Jakarta Slide example</title>
    </header>
    <body>
      <row>
        <column title="Back">
          <a href="../">Back</a> - to Cocoon examples main page
        </column>
        <column title="Login">
          <p class="samplesNote">These Slide examples require Java Transaction
          API library to be present. Get jta.jar and place it to the lib folder
          before trying these examples. You will also need enabled uploads in web.xml .
          </p>
          <table border="0" cellspacing="0" cellpadding="2">
            <form action="${prefix}/login.cont" method="post">
              <input type="hidden" name="continuationId" value="${continuation.id}"/>
              <tr>
                <td>Username</td>
                <td>
                  <input name="userid" value="${userid}" type="text" size="15" maxlength="40"/>
                </td>
              </tr>
              <tr>
                <td>Password</td>
                <td>
                  <input name="password" type="password" size="15" maxlength="40"/>
                </td>
              </tr>
              <tr>
                <td/>
                <td>
                  <input type="submit" name="cocoon-login" value="Login"/>
                </td>
              </tr>
              <tr>
                <td/>
                <td>Try root,root or john,john</td>
              </tr>
            </form>
          </table>
        </column>
      </row>
    </body>
  </document>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/screens/privileges.jx
  
  Index: privileges.jx
  ===================================================================
  <?xml version="1.0"?>
  <privileges xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
    <jx:forEach var="privilege" items="${privileges}">
      <privilege>
        <uri>${privilege}</uri>
      </privilege>
    </jx:forEach>
  </privileges>
  
  
  
  1.1                  cocoon-2.1/src/blocks/slide/samples/screens/locks.jx
  
  Index: locks.jx
  ===================================================================
  <?xml version="1.0"?>
  <locks xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
    <jx:forEach var="lock" items="${locks}">
      <lock>
        <id>${lock.getLockId()}</id>
        <object>${lock.getObjectUri()}</object>
        <type>${lock.getTypeUri()}</type>
        <subject>${lock.getSubjectUri()}</subject>
        <expiration>${lock.getExpirationDate()}</expiration>
        <exclusive>${lock.isExclusive()}</exclusive>
        <inheritable>${lock.isInheritable()}</inheritable>
      </lock>
    </jx:forEach>
  </locks>
  
  
  
  1.16      +143 -184  cocoon-2.1/src/blocks/slide/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/sitemap.xmap,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- sitemap.xmap	14 Dec 2003 16:06:38 -0000	1.15
  +++ sitemap.xmap	12 Jan 2004 17:10:33 -0000	1.16
  @@ -4,31 +4,29 @@
   
   <!-- =========================== Components =================================== -->
   
  - <map:components>
  -  <map:generators default="file">
  -   <map:generator name="traverse" 
  -                  src="org.apache.cocoon.generation.TraversableSourceDescriptionGenerator" 
  -                  logger="sitemap.generator.traverse"
  -                  label="content"/>
  -  </map:generators>
  -
  -  <map:transformers default="xslt"/>
  -  <map:readers default="resource"/>
  -  <map:serializers default="html"/>
  -  <map:matchers default="wildcard"/>
  -  <map:selectors default="browser"/>
  -
  -  <map:actions>
  -   <map:action name="auth-protect" logger="sitemap.action.auth-protect" 
  -               src="org.apache.cocoon.webapps.authentication.acting.AuthAction"/>
  -   <map:action name="auth-login" logger="sitemap.action.auth-login"
  -               src="org.apache.cocoon.webapps.authentication.acting.LoginAction"/>
  -   <map:action name="auth-logout" logger="sitemap.action.auth-logout"
  -               src="org.apache.cocoon.webapps.authentication.acting.LogoutAction"/>
  -   <map:action name="auth-loggedIn" logger="sitemap.action.auth-loggedIn"
  -               src="org.apache.cocoon.webapps.authentication.acting.LoggedInAction"/>
  -  </map:actions>
  - </map:components>
  +  <map:components>
  +    <map:generators default="file">
  +      <map:generator 
  +        name="traverse" 
  +        src="org.apache.cocoon.generation.TraversableSourceDescriptionGenerator" 
  +        logger="sitemap.generator.traverse"
  +        label="content"
  +      />
  +    </map:generators>
  +
  +    <map:transformers default="xslt"/>
  +    <map:readers default="resource"/>
  +    <map:serializers default="html"/>
  +    <map:matchers default="wildcard"/>
  +    <map:selectors default="browser"/>
  +  
  +    <map:pipes default="noncaching">
  +      <map:pipe name="event-caching" 
  +                src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
  +        <parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"/>
  +      </map:pipe>
  +    </map:pipes>
  +  </map:components>
   
   <!-- ========================== Flowscript ================================= -->
   
  @@ -38,140 +36,71 @@
     
   <!-- =========================== Views =================================== -->
   
  - <map:views>
  -  <map:view name="content" from-label="content">
  -   <map:serialize type="xml"/>
  -  </map:view>
  -  <map:view from-label="content" name="pretty-content">
  -   <map:transform src="context://stylesheets/system/xml2html.xslt"/>
  -   <map:serialize type="html"/>
  -  </map:view>
  - </map:views>
  -
  +  <map:views>
  +    <map:view name="content" from-label="content">
  +      <map:serialize type="xml"/>
  +    </map:view>
  +    <map:view from-label="content" name="pretty-content">
  +      <map:transform src="context://stylesheets/system/xml2html.xslt"/>
  +      <map:serialize type="html"/>
  +    </map:view>
  +  </map:views>
   
   <!-- =========================== Pipelines ================================= -->
   
    <map:pipelines>
      
      <map:component-configurations>
  -     <authentication-manager>
  -       <handlers>
  -         <handler name="slidehandler" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  -           <redirect-to    uri="cocoon://slide-samples/login.html"/>
  -           <authentication uri="cocoon:/screens/authenticate/none/"/>
  -         </handler>
  -       </handlers>
  -     </authentication-manager>
        <global-variables>
          <namespace>cocoon</namespace>
  -       <base>/samples/slide</base>
  +       <base>/slide-samples</base>
        </global-variables>
  -  </map:component-configurations>
  -
  -
  -  <map:pipeline internal-only="false" type="noncaching">
  +   </map:component-configurations>
      
  -   <map:match pattern="screens/*/*/**">
  -     <map:call function="screen_{1}">
  -       <map:parameter name="caller" value="{2}" />
  -       <map:parameter name="path" value="{3}" />
  -     </map:call>
  -   </map:match>
  +   <map:pipeline internal-only="true" type="noncaching">
  +     <map:match pattern="screens/*/**">
  +       <map:call function="screen_{1}">
  +         <map:parameter name="path" value="{2}" />
  +       </map:call>
  +     </map:match>
  +     
  +     <map:match pattern="screens/*.jx">
  +       <map:generate type="jx" src="screens/{1}.jx" />
  +       <map:serialize type="xml" />
  +     </map:match>
  +     
  +     <map:match pattern="screens/login.html">
  +       <map:generate type="jx" src="screens/login.jx"/>
  +       <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       </map:transform>
  +       <map:serialize/>
  +     </map:match>
  +   </map:pipeline>
      
  -   <map:match pattern="screens/*.jx">
  -     <map:generate type="jx" src="screens/{1}.jx" />
  -     <map:serialize type="xml" />
  -   </map:match>
  -    
  -   <map:match pattern="users/*/*">
  -     <map:generate type="traverse" src="slide://{2}@{global:namespace}/{1}?scope=/">
  -       <map:parameter name="properties" value="true"/>
  -       <map:parameter name="permissions" value="false"/>
  -       <map:parameter name="locks" value="false"/>
  -       <map:parameter name="version" value="false"/>
  -       <map:parameter name="depth" value="1"/>
  -     </map:generate>
  -     <map:serialize type="xml"/>
  -    </map:match>
  -    
  -   <!-- =============  Source description ============= -->
  -   <map:match pattern="description/*/**">
  -    <map:generate type="traverse" src="slide://{1}@{global:namespace}/{2}">
  -     <map:parameter name="properties" value="true"/>
  -     <map:parameter name="permissions" value="false"/>
  -     <map:parameter name="locks" value="true"/>
  -     <map:parameter name="version" value="false"/>
  -     <map:parameter name="depth" value="1"/>
  -    </map:generate>
  -    <map:serialize type="xml"/>
  -   </map:match>
  -
  -  
  -  </map:pipeline>
  -
  -
  -  <map:pipeline type="noncaching">
  -    <map:match pattern="">
  -      <map:redirect-to uri="content/"/>
  -    </map:match>
  - 
  -    <map:match pattern="login.html">
  -      <map:generate src="screens/login.xml"/>
  -      <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  -        <map:parameter name="contextPath" value="{request:contextPath}"/>
  -      </map:transform>
  -      <map:serialize/>
  -    </map:match>
  -
  -    <map:match pattern="login">
  -      <map:act type="auth-login">
  -        <map:parameter name="handler" value="slidehandler"/>
  -        <map:parameter name="parameter_name" value="{request-param:userid}"/>
  -        <map:parameter name="parameter_password" value="{request-param:password}"/>
  -        <map:redirect-to uri="{request-param:resource}"/>
  -      </map:act>
  -
  -      <map:generate src="screens/login-failed.xml"/>
  -      <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  -        <map:parameter name="contextPath" value="{request:contextPath}"/>
  -      </map:transform>
  -      <map:serialize/>
  -    </map:match>
  -
  -    <map:match pattern="logout.html">
  -      <map:act type="auth-logout">
  -        <map:parameter name="handler" value="slidehandler"/>
  -
  -        <map:generate src="screens/logout.xml"/>
  -        <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  -          <map:parameter name="contextPath" value="{request:contextPath}"/>
  -        </map:transform>
  -        <map:serialize/>
  -      </map:act>
  -
  -      <map:redirect-to uri="login.html"/>
  -    </map:match>
  -
  -    <map:match pattern="**">
  -      <map:act type="auth-protect">
  -        <map:parameter name="handler" value="slidehandler"/>
  -        
  -        <map:match pattern="*.do">
  -          <map:call function="public_{1}">
  -            <map:parameter name="caller"    value="{../ID}" />
  -            <map:parameter name="namespace" value="{global:namespace}" />
  -          </map:call>
  -        </map:match>
  -
  -     <!-- ============= Source content ================== -->
  -
  +   <map:pipeline internal-only="true" type="noncaching">
  +     <!-- ========== general description ========== -->
  +     <map:match pattern="description/**">
  +       <map:generate type="traverse" src="slide://{session-attr:slide-principal}@{global:namespace}/{1}">
  +         <map:parameter name="properties" value="true"/>
  +         <map:parameter name="permissions" value="false"/>
  +         <map:parameter name="locks" value="false"/>
  +         <map:parameter name="version" value="false"/>
  +         <map:parameter name="depth" value="1"/>
  +       </map:generate>
  +       <map:serialize type="xml"/>
  +     </map:match>
  +     
  +     <!-- ============= content ================== -->
        <map:match pattern="content/**">
  -       <map:generate src="cocoon:/description/{../ID}/{1}"/>
  -       <map:transform src="styles/description2html4content.xsl">
  +       <map:aggregate element="document" label="content">
  +         <map:part src="cocoon:/description/{1}" />
  +       </map:aggregate>
  +       <map:transform src="styles/content2html.xsl">
            <map:parameter name="base" value="{request:contextPath}{global:base}"/>
            <map:parameter name="path" value="{1}" />
            <map:parameter name="namespace" value="{global:namespace}" />
  -         <map:parameter name="principal" value="{../ID}"/>
  +         <map:parameter name="principal" value="{session-attr:slide-principal}"/>
          </map:transform>
          <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
            <map:parameter name="base" value="{global:base}"/>
  @@ -180,72 +109,102 @@
          <map:transform type="xinclude"/>
          <map:serialize type="html"/>
        </map:match>
  -
  -     <!-- ============= Source properties =============== -->
  +     
  +     <!-- ============= properties =============== -->
        <map:match pattern="properties/**">
  -      <map:generate src="cocoon:/description/{../ID}/{1}"/>
  -      <map:transform src="styles/description2html4properties.xsl">
  +       <map:aggregate element="document" label="content">
  +         <map:part src="cocoon:/description/{1}" />
  +       </map:aggregate>
  +       <map:transform src="styles/properties2html.xsl">
            <map:parameter name="base" value="{request:contextPath}{global:base}"/>
            <map:parameter name="path" value="{1}" />
  -      </map:transform>
  -      <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  -       <map:parameter name="contextPath" value="{request:contextPath}"/>
  -      </map:transform>
  -      <map:serialize type="html"/>
  +       </map:transform>
  +       <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       </map:transform>
  +       <map:serialize type="html"/>
        </map:match>
  -
  -     <!-- ============= Source permissions ============== -->
  +     
  +     <!-- ============= permissions ============== -->
        <map:match pattern="permissions/**">
          <map:aggregate element="document" label="content">
  -         <map:part src="cocoon:/screens/permissions/{../ID}/{1}" />
  -         <map:part src="cocoon:/screens/actions/{../ID}/{1}" />
  -         <map:part src="cocoon:/screens/groups/{../ID}/{1}" />
  -         <map:part src="cocoon:/screens/users/{../ID}/{1}" />
  -         <map:part src="cocoon:/screens/roles/{../ID}/{1}" />
  -         <map:part src="cocoon:/description/{../ID}/{1}" />
  +         <map:part src="cocoon:/screens/permissions/{1}" />
  +         <map:part src="cocoon:/screens/privileges/{1}" />
  +         <map:part src="cocoon:/screens/groups/{1}" />
  +         <map:part src="cocoon:/screens/users/{1}" />
  +         <map:part src="cocoon:/screens/roles/{1}" />
  +         <map:part src="cocoon:/description/{1}" />
          </map:aggregate>
          <map:transform src="styles/permissions2html.xsl">
            <map:parameter name="base" value="{request:contextPath}{global:base}"/>
            <map:parameter name="path" value="{1}" />
  +         <map:parameter name="userspath" value="{slide-config:/userspath}" />
  +         <map:parameter name="rolespath" value="{slide-config:/rolespath}" />
  +         <map:parameter name="groupspath" value="{slide-config:/groupspath}" />
  +         <map:parameter name="actionspath" value="{slide-config:/actionspath}" />
          </map:transform>
          <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
            <map:parameter name="contextPath" value="{request:contextPath}"/>
          </map:transform>
          <map:serialize type="html"/>
        </map:match>
  -
  -     <!-- ============= Source locks ==================== -->
  +     
  +     <!-- ============= locks ==================== -->
        <map:match pattern="locks/**">
  -      <map:generate src="cocoon:/description/{../ID}/{1}"/>
  -      <map:transform src="styles/description2html4locks.xsl">
  -       <map:parameter name="base" value="{request:contextPath}{global:base}"/>
  -       <map:parameter name="path" value="{1}" />
  -      </map:transform>
  -      <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  -       <map:parameter name="contextPath" value="{request:contextPath}"/>
  -      </map:transform>
  -      <map:serialize type="html"/>
  +       <map:aggregate element="document" label="content">
  +         <map:part src="cocoon:/screens/locks/{1}" />
  +         <map:part src="cocoon:/description/{1}" />
  +       </map:aggregate>
  +       <map:transform src="styles/locks2html.xsl">
  +         <map:parameter name="base" value="{request:contextPath}{global:base}"/>
  +         <map:parameter name="path" value="{1}" />
  +       </map:transform>
  +       <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       </map:transform>
  +       <map:serialize type="html"/>
        </map:match>
  -
  -     <!-- ============= Repository users =============== -->
  -     <map:match pattern="users/">
  -      <map:aggregate element="users" label="content">
  -        <map:part element="users" src="cocoon:/users/users/{../ID}"/>
  -        <map:part element="groups" src="cocoon:/users/groups/{../ID}" />
  -        <map:part element="roles" src="cocoon:/users/roles/{../ID}" />
  +     
  +     <!-- ============= users ==================== -->
  +     <map:match pattern="users">
  +      <map:aggregate element="document" label="content">
  +        <map:part src="cocoon:/screens/users/"/>
  +        <map:part src="cocoon:/screens/groups/" />
  +        <map:part src="cocoon:/screens/roles/" />
         </map:aggregate>
  -      <map:transform src="styles/description2html4users.xsl">
  +      <map:transform src="styles/users2html.xsl">
          <map:parameter name="base" value="{request:contextPath}{global:base}"/>
  +       <map:parameter name="userspath" value="{slide-config:/userspath}" />
  +       <map:parameter name="rolespath" value="{slide-config:/rolespath}" />
  +       <map:parameter name="groupspath" value="{slide-config:/groupspath}" />
         </map:transform>
         <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
          <map:parameter name="contextPath" value="{request:contextPath}"/>
         </map:transform>
         <map:serialize type="html"/>
        </map:match>
  +   </map:pipeline>
  +   
  +   <map:pipeline type="noncaching">
  +     <map:match pattern="">
  +       <map:redirect-to uri="content/"/>
  +     </map:match>
        
  -    </map:act>
  -   </map:match>
  -			
  -  </map:pipeline>
  +     <map:match pattern="**.cont">
  +       <map:call continuation="{request-param:continuationId}" />
  +     </map:match>
  +     
  +     <map:match pattern="logout">
  +       <map:call function="logout"/>
  +     </map:match>
  +          
  +     <map:match pattern="**">
  +       <map:call function="protect">
  +         <map:parameter name="path" value="{1}" />
  +       </map:call>
  +     </map:match>
  +   </map:pipeline>
  +   
    </map:pipelines>
  +
   </map:sitemap>
  
  
  
  1.5       +130 -117  cocoon-2.1/src/blocks/slide/samples/flow.js
  
  Index: flow.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/flow.js,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- flow.js	14 Dec 2003 15:55:33 -0000	1.4
  +++ flow.js	12 Jan 2004 17:10:33 -0000	1.5
  @@ -1,62 +1,109 @@
   
   importPackage(Packages.org.apache.cocoon.components.slide);
  -importPackage(Packages.org.apache.cocoon.samples.slide);
   importPackage(Packages.org.apache.cocoon.components.source.helpers);
  +importPackage(Packages.org.apache.cocoon.samples.slide);
   importPackage(Packages.org.apache.excalibur.source);
  -importPackage(Packages.org.apache.excalibur.xml.dom);
   
   var repository = cocoon.getComponent("org.apache.cocoon.components.repository.SourceRepository");
   var resolver = cocoon.getComponent(SourceResolver.ROLE);
   var slide = cocoon.getComponent(SlideRepository.ROLE);
   var nat = slide.getNamespaceToken("cocoon");
   
  +// these variables need to be available in the sitemap as well
  +// is/should there be a simple way to share these? an input module?
  +var principal;
  +var namespace = "cocoon";
  +var base = "/slide-samples/";
  +
   // ---------------------------------------------- utility functions
   
   function getBaseURI() {
  -  var namespace = cocoon.parameters["namespace"];
  -  var caller    = cocoon.parameters["caller"];
  -  return "slide://" + caller + "@" + namespace + "/";
  +  return "slide://" + principal + "@" + namespace + "/";
  +}
  +
  +// ---------------------------------------------- authentication
  +
  +function protect() {
  +  var path = cocoon.parameters["path"];
  +  if (principal == undefined){
  +    login(path);
  +  }
  +  else {
  +    invoke(path);
  +  }
  +}
  +
  +function invoke(path) {
  +  var func = this["protected_" + path];
  +  if (func != undefined) {
  +    func.apply(this);
  +  }
  +  else {
  +    cocoon.sendPage(path,null);
  +  }
  +}
  +
  +function login(path) {
  +  cocoon.session;
  +  var userid = "";
  +  while (principal == undefined) {
  +    cocoon.sendPageAndWait("screens/login.html",{userid:userid,prefix:"/slide-samples"});
  +    userid       = cocoon.request.getParameter("userid");
  +    var password = cocoon.request.getParameter("password");
  +    if (AdminHelper.login(nat,userid,password)) {
  +      principal = userid;
  +      // also put it in the session so it can be accessed 
  +      // from the sitemap throuhg the session attribute module
  +      cocoon.session.setAttribute("slide-principal",principal);
  +    }
  +  }
  +  cocoon.redirectTo(base + path);
  +}
  +
  +function logout() {
  +  cocoon.session.invalidate();
  +  cocoon.redirectTo(base + "content/");
   }
   
   // ---------------------------------------------- file management
   
   // make a new collection
  -function public_mkcol() {
  +function protected_mkcol() {
     var baseUri        = getBaseURI();
     var parentPath     = cocoon.request.getParameter("parentPath");
     var collectionName = cocoon.request.getParameter("collectionName");
  -  var location = baseUri + parentPath + collectionName;
  +  var location = baseUri + parentPath + "/" + collectionName;
     var status = repository.makeCollection(location);
   
  -  cocoon.redirectTo("content/" + parentPath);
  +  cocoon.redirectTo(base + "content/" + parentPath);
   }
   
   // upload a file
  -function public_upload() {
  +function protected_upload() {
     var baseUri      = getBaseURI();
     var parentPath   = cocoon.request.getParameter("parentPath");
     var resourceName = cocoon.request.getParameter("resourceName");
  -  var dest = baseUri + parentPath + resourceName;
  +  var dest = baseUri + parentPath + "/" + resourceName;
     var src  = "upload://uploadFile";
     
     var status = repository.save(src,dest);
  -  cocoon.redirectTo("content/" + parentPath);
  +  cocoon.redirectTo(base + "content/" + parentPath);
   }
   
   // delete a resource
  -function public_delete() {
  +function protected_delete() {
     var baseUri = getBaseURI();
     var parentPath = cocoon.request.getParameter("parentPath");
     var resourceName = cocoon.request.getParameter("resourceName");
  -  var location = baseUri + parentPath + resourceName;
  +  var location = baseUri + parentPath + "/" + resourceName;
     
     var status = repository.remove(location);
  -  cocoon.redirectTo("content/" + parentPath);
  +  cocoon.redirectTo(base + "content/" + parentPath);
   }
   
   // ---------------------------------------------- property management
   
  -function public_addproperty() {
  +function protected_addproperty() {
     var baseUri      = getBaseURI();
     var resourcePath = cocoon.request.getParameter("resourcePath");
     var location     = baseUri + resourcePath;
  @@ -67,7 +114,7 @@
       var namespace = cocoon.request.getParameter("namespace");
       var value     = cocoon.request.getParameter("value");
       var property = new SourceProperty(namespace,name,value);
  -    cocoon.log.info("setting property " + property + " on source " + location);
  +    
       source.setSourceProperty(property);
     }
     finally {
  @@ -75,10 +122,10 @@
         resolver.release(source);
       }
     }
  -  cocoon.redirectTo("properties/" + resourcePath);
  +  cocoon.redirectTo(base + "properties/" + resourcePath);
   }
   
  -function public_removeproperty() {
  +function protected_removeproperty() {
     var baseUri = getBaseURI();
     var resourcePath = cocoon.request.getParameter("resourcePath");
     var location = baseUri + resourcePath;
  @@ -87,166 +134,132 @@
       source = resolver.resolveURI(location);
       var name      = cocoon.request.getParameter("name");
       var namespace = cocoon.request.getParameter("namespace");
  -    cocoon.log.info("removing property " + namespace + "#" + name + " from source " + location);
  +    
       source.removeSourceProperty(namespace,name);
     } finally {
       if (source != null) {
         resolver.release(source);
       }
     }
  -  cocoon.redirectTo("properties/" + resourcePath);
  +  cocoon.redirectTo(base + "properties/" + resourcePath);
   }
   
  -// ---------------------------------------------- lock management
  +// ---------------------------------------------- permission management
   
  -function public_removelock() {
  -  var baseUri = getBaseURI();
  +function protected_removePermission() {
     var resourcePath = cocoon.request.getParameter("resourcePath");
  -  var subject = cocoon.request.getParameter("subject");
  -  var location = baseUri + resourcePath;
  +  var subject      = cocoon.request.getParameter("subject");
  +  var privilege    = cocoon.request.getParameter("privilege");
     
  -  cocoon.log.info("removing lock " + subject + " from source " + location);
  +  AdminHelper.removePermission(nat,principal,resourcePath,subject,privilege);
  +  cocoon.redirectTo(base + "permissions/" + resourcePath);
  +}
  +
  +function protected_addPermission() {
  +  var resourcePath = cocoon.request.getParameter("resourcePath");
  +  var subject      = cocoon.request.getParameter("subject");
  +  var action       = cocoon.request.getParameter("action");
  +  var inheritable  = cocoon.request.getParameter("inheritable");
  +  var negative     = cocoon.request.getParameter("negative");
     
  -  // TODO: remove lock
  +  AdminHelper.addPermission(nat,principal,resourcePath,subject,action,inheritable,negative);
  +  cocoon.redirectTo(base + "permissions/" + resourcePath);
  +}
  +
  +// ---------------------------------------------- lock management
  +
  +function protected_removelock() {
  +  var resourcePath = cocoon.request.getParameter("resourcePath");
  +  var objectUri    = cocoon.request.getParameter("objectUri");
  +  var lockId       = cocoon.request.getParameter("lockId");
     
  -  cocoon.redirectTo("locks/" + resourcePath);
  +  AdminHelper.removeLock(nat,principal,objectUri,lockId);
  +  cocoon.redirectTo(base + "locks/" + resourcePath);
   }
   
  -function public_addlock() {
  -  var baseUri = getBaseURI();
  +function protected_addlock() {
     var resourcePath = cocoon.request.getParameter("resourcePath");
     var subject      = cocoon.request.getParameter("subject");
     var type         = cocoon.request.getParameter("type");
  -  var inheritable  = cocoon.request.getParameter("inheritable");
     var exclusive    = cocoon.request.getParameter("exclusive");
  -  var location = baseUri + resourcePath;
  -  
  -  cocoon.log.info("adding lock " + subject + " to source " + location);
  +  var inheritable  = cocoon.request.getParameter("inheritable");
     
  -  // TODO: add lock
  +  AdminHelper.addLock(nat,principal,resourcePath,subject,type,exclusive,inheritable);
     
  -  cocoon.redirectTo("locks/" + resourcePath);
  +  cocoon.redirectTo(base + "locks/" + resourcePath);
   }
   
   // ---------------------------------------------- user management
   
  -function public_adduser() {
  +function protected_adduser() {
     var username = cocoon.request.getParameter("username");
     var password = cocoon.request.getParameter("password");
  -  var role     = cocoon.request.getParameter("role");
  -  var caller   = cocoon.parameters["caller"];
  -  
  -  AdminHelper.addUser(nat,caller,username,password,role);
  -  cocoon.redirectTo("users/");
  -}
  -
  -function public_removeuser() {
  -  var username = cocoon.request.getParameter("username");
  -  var caller   = cocoon.parameters["caller"];
     
  -  AdminHelper.removeUser(nat,caller,username);
  -  cocoon.redirectTo("users/");
  +  AdminHelper.addUser(nat,principal,username,password);
  +  cocoon.redirectTo(base + "users");
   }
   
  -function public_addgroup() {
  +function protected_addgroup() {
     var groupname = cocoon.request.getParameter("groupname");
  -  var caller    = cocoon.parameters["caller"];
     
  -  AdminHelper.addGroup(nat,caller,groupname);
  -  cocoon.redirectTo("users/");
  +  AdminHelper.addGroup(nat,principal,groupname);
  +  cocoon.redirectTo("users");
   }
   
  -function public_removegroup() {
  -  var groupname = cocoon.request.getParameter("groupname");
  -  var caller    = cocoon.parameters["caller"];
  +function protected_removeobject() {
  +  var objecturi = cocoon.request.getParameter("objecturi");
     
  -  AdminHelper.removeGroup(nat,caller,groupname);
  -  cocoon.redirectTo("users/");
  +  AdminHelper.removeObject(nat,principal,objecturi);
  +  cocoon.redirectTo(base + "users");
   }
   
  -function public_addmember() {
  -  var username  = cocoon.request.getParameter("username");
  -  var groupname = cocoon.request.getParameter("groupname");
  -  var caller    = cocoon.parameters["caller"];
  +function protected_addmember() {
  +  var objecturi  = cocoon.request.getParameter("objecturi");
  +  var subjecturi = cocoon.request.getParameter("subjecturi");
     
  -  AdminHelper.addGroupMember(nat,caller,groupname,username);
  -  cocoon.redirectTo("users/");
  +  AdminHelper.addMember(nat,principal,objecturi,subjecturi);
  +  cocoon.redirectTo(base + "users");
   }
   
  -function public_removemember() {
  -  var username  = cocoon.request.getParameter("username");
  -  var groupname = cocoon.request.getParameter("groupname");
  -  var caller    = cocoon.parameters["caller"];
  +function protected_removemember() {
  +  var objecturi  = cocoon.request.getParameter("objecturi");
  +  var subjecturi = cocoon.request.getParameter("subjecturi");
     
  -  AdminHelper.removeGroupMember(nat,caller,groupname,username);
  -  cocoon.redirectTo("users/");
  +  AdminHelper.removeMember(nat,principal,objecturi,subjecturi);
  +  cocoon.redirectTo(base + "users");
   }
   
  -// ---------------------------------------------- permission management
  -
  -function public_removePermission() {
  -  var caller       = cocoon.parameters["caller"];
  -  var resourcePath = cocoon.request.getParameter("resourcePath");
  -  var subject      = cocoon.request.getParameter("subject");
  -  var action       = cocoon.request.getParameter("action");
  -  
  -  AdminHelper.removePermission(nat,caller,resourcePath,subject,action);
  -  cocoon.redirectTo("permissions/" + resourcePath);
  -}
  -
  -function public_addPermission() {
  -  var caller       = cocoon.parameters["caller"];
  -  var resourcePath = cocoon.request.getParameter("resourcePath");
  -  var subject      = cocoon.request.getParameter("subject");
  -  var action       = cocoon.request.getParameter("action");
  -  var inheritable  = cocoon.request.getParameter("inheritable");
  -  var negative     = cocoon.request.getParameter("negative");
  -  
  -  AdminHelper.addPermission(nat,caller,resourcePath,subject,action,inheritable,negative);
  -  cocoon.redirectTo("permissions/" + resourcePath);
  -}
   
   // ---------------------------------------------- screens
   
  -function screen_authenticate() {
  -  var userid = cocoon.request.getParameter("userid");
  -  var password = cocoon.request.getParameter("password");
  -  cocoon.sendPage("screens/authentication.jx",{id:userid,role:"root"});
  -}
  -
   function screen_permissions() {
  -  var caller = cocoon.parameters["caller"];
     var path   = cocoon.parameters["path"];
  -  
  -  var permissions = AdminHelper.listPermissions(nat,caller,path);
  +  var permissions = AdminHelper.listPermissions(nat,principal,path);
     cocoon.sendPage("screens/permissions.jx",{permissions:permissions});
   }
   
  -function screen_actions() {
  -  var caller = cocoon.parameters["caller"];
  -  
  -  var actions = AdminHelper.listActions(nat,caller);
  -  cocoon.sendPage("screens/actions.jx",{actions:actions});
  +function screen_locks() {
  +  var path   = cocoon.parameters["path"];
  +  var locks = AdminHelper.listLocks(nat,principal,path);
  +  cocoon.sendPage("screens/locks.jx",{locks:locks});
  +}
  +
  +function screen_privileges() {
  +  var privileges = AdminHelper.listPrivileges(nat,principal);
  +  cocoon.sendPage("screens/privileges.jx",{privileges:privileges});
   }
   
   function screen_groups() {
  -  var caller = cocoon.parameters["caller"];
  -  
  -  var groups = AdminHelper.listGroups(nat,caller);
  +  var groups = AdminHelper.listGroups(nat,principal,"/groups");
     cocoon.sendPage("screens/groups.jx",{groups:groups});
   }
   
   function screen_roles() {
  -  var caller = cocoon.parameters["caller"];
  -  
  -  var roles = AdminHelper.listRoles(nat,caller);
  +  var roles = AdminHelper.listGroups(nat,principal,"/roles");
     cocoon.sendPage("screens/roles.jx",{roles:roles});
   }
   
   function screen_users() {
  -  var caller = cocoon.parameters["caller"];
  -  
  -  var users = AdminHelper.listUsers(nat,caller);
  +  var users = AdminHelper.listUsers(nat,principal);
     cocoon.sendPage("screens/users.jx",{users:users});
   }
  -
  
  
  
  1.3       +251 -146  cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/samples/slide/AdminHelper.java
  
  Index: AdminHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/samples/slide/AdminHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AdminHelper.java	22 Dec 2003 13:35:06 -0000	1.2
  +++ AdminHelper.java	12 Jan 2004 17:10:33 -0000	1.3
  @@ -52,6 +52,7 @@
   package org.apache.cocoon.samples.slide;
   
   import java.util.ArrayList;
  +import java.util.Collections;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.List;
  @@ -64,6 +65,8 @@
   import org.apache.slide.content.NodeProperty;
   import org.apache.slide.content.NodeRevisionDescriptor;
   import org.apache.slide.content.NodeRevisionDescriptors;
  +import org.apache.slide.lock.Lock;
  +import org.apache.slide.lock.NodeLock;
   import org.apache.slide.macro.Macro;
   import org.apache.slide.macro.MacroParameters;
   import org.apache.slide.security.NodePermission;
  @@ -80,16 +83,38 @@
    */
   public class AdminHelper {
       
  +    private static final SlideToken ROOT = new SlideTokenImpl(new CredentialsToken("root"));
  +    
  +    public static boolean login(NamespaceAccessToken nat,
  +                                String userId,
  +                                String password) throws Exception {
  +        
  +        String usersPath = nat.getNamespaceConfig().getUsersPath();
  +        String userUri = usersPath + "/" + userId;
  +        
  +        Content content = nat.getContentHelper();
  +        
  +        try {
  +            NodeRevisionDescriptors revisions = content.retrieve(ROOT,userUri);
  +            NodeRevisionDescriptor revision = content.retrieve(ROOT,revisions);
  +            NodeProperty property = revision.getProperty(
  +                "password",NodeProperty.SLIDE_NAMESPACE);
  +            
  +            return property.getValue().equals(password);
  +        }
  +        catch (Exception e) {
  +            e.printStackTrace();
  +            throw e;
  +        }
  +    }
  +    
       public static void addUser(NamespaceAccessToken nat, 
                                  String caller, 
                                  String username, 
  -                               String password, 
  -                               String rolename) throws Exception {
  +                               String password) throws Exception {
           
           String usersPath = nat.getNamespaceConfig().getUsersPath();
           String userUri = usersPath + "/" + username;
  -        String rolesPath = nat.getNamespaceConfig().getRolesPath();
  -        String roleUri = rolesPath + "/" + rolename;
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Structure structure = nat.getStructureHelper();
  @@ -97,8 +122,6 @@
           
           try {
               
  -            // make sure the role exists
  -            structure.retrieve(slideToken,roleUri);
               nat.begin();
               
               ObjectNode user = new SubjectNode();
  @@ -112,23 +135,6 @@
                   "password",password,NodeProperty.SLIDE_NAMESPACE));
               content.create(slideToken,userUri,descriptor,null);
               
  -            if (rolename != null && !rolename.equals("")) {
  -                // modify the role descriptor
  -                NodeRevisionDescriptors descriptors = content.retrieve(slideToken,roleUri);
  -                descriptor = content.retrieve(slideToken,descriptors);
  -                NodeProperty property = descriptor.getProperty("group-member-set","DAV:");
  -                String value;
  -                if (property != null) {
  -                    value = (String) property.getValue();
  -                }
  -                else {
  -                    value = "";
  -                }
  -                value += "<D:href xmlns:D=\"DAV:\">" + userUri + "</D:href>";
  -                descriptor.setProperty("group-member-set","DAV:",value);
  -                content.store(slideToken,roleUri,descriptor,null);
  -            }
  -            
               nat.commit();
           }
           catch (Exception e) {
  @@ -143,44 +149,6 @@
           
       }
       
  -    public static void removeUser(NamespaceAccessToken nat,
  -                                  String caller,
  -                                  String username) throws Exception {
  -        
  -        String usersPath = nat.getNamespaceConfig().getUsersPath();
  -        String userUri = usersPath + "/" + username;
  -        String callerUri = usersPath + "/" + caller;
  -        
  -        // user cannot delete itself
  -        if (callerUri.equals(userUri)) {
  -            return;
  -        }
  -        
  -        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
  -        Macro macro = nat.getMacroHelper();
  -        
  -        try {
  -            nat.begin();
  -            
  -            boolean recursive = true;
  -            boolean overwrite = false;
  -            MacroParameters parameters = new MacroParameters(recursive,overwrite);
  -            
  -            macro.delete(slideToken,userUri,parameters);
  -            
  -            nat.commit();
  -        }
  -        catch (Exception e) {
  -            try {
  -                nat.rollback();
  -            }
  -            catch (Exception f) {
  -                f.printStackTrace();
  -            }
  -            throw e;
  -        }
  -    }
  -    
       public static void addGroup(NamespaceAccessToken nat,
                                   String caller,
                                   String groupname) throws Exception {
  @@ -218,25 +186,30 @@
           
       }
       
  -    public static void removeGroup(NamespaceAccessToken nat,
  -                                   String caller,
  -                                   String groupname) throws Exception {
  -        
  -        String groupsPath = nat.getNamespaceConfig().getGroupsPath();
  -        String groupUri = groupsPath + "/" + groupname;
  +    public static void removeObject(NamespaceAccessToken nat,
  +                                    String caller,
  +                                    String objectUri) throws Exception {
           
  +        String usersPath = nat.getNamespaceConfig().getUsersPath();
  +        String callerUri = usersPath + "/" + caller;
  +                                        
  +        // user cannot delete itself
  +        if (callerUri.equals(objectUri)) {
  +            return;
  +        }
  +    
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Macro macro = nat.getMacroHelper();
  -        
  +    
           try {
               nat.begin();
  -            
  +    
               boolean recursive = true;
               boolean overwrite = false;
               MacroParameters parameters = new MacroParameters(recursive,overwrite);
  -            
  -            macro.delete(slideToken,groupUri,parameters);
  -            
  +    
  +            macro.delete(slideToken,objectUri,parameters);
  +    
               nat.commit();
           }
           catch (Exception e) {
  @@ -250,15 +223,10 @@
           }
       }
       
  -    public static void addGroupMember(NamespaceAccessToken nat,
  -                                      String caller,
  -                                      String groupname,
  -                                      String username) throws Exception {
  -        
  -        String groupsPath = nat.getNamespaceConfig().getGroupsPath();
  -        String groupUri = groupsPath + "/" + groupname;
  -        String usersPath = nat.getNamespaceConfig().getUsersPath();
  -        String userUri = usersPath + "/" + username;
  +    public static void addMember(NamespaceAccessToken nat,
  +                                 String caller,
  +                                 String objectUri,
  +                                 String subjectUri) throws Exception {
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Structure structure = nat.getStructureHelper();
  @@ -266,17 +234,17 @@
           
           try {
               
  -            // check if the user exists
  -            structure.retrieve(slideToken,userUri);
  +            // check if the subject exists
  +            structure.retrieve(slideToken,subjectUri);
               
  -            NodeRevisionDescriptors descriptors = content.retrieve(slideToken,groupUri);
  +            NodeRevisionDescriptors descriptors = content.retrieve(slideToken,objectUri);
               NodeRevisionDescriptor descriptor = content.retrieve(slideToken,descriptors);
               NodeProperty property = descriptor.getProperty("group-member-set","DAV:");
               
               String value = null;
               if (property != null) {
                   value = (String) property.getValue();
  -                if (value.indexOf(userUri) != -1) {
  +                if (value.indexOf(subjectUri) != -1) {
                       // user already a member of this group
                       return;
                   }
  @@ -284,11 +252,11 @@
               else {
                   value = "";
               }
  -            value = value + "<D:href xmlns:D='DAV:'>" + userUri + "</D:href>";
  +            value = value + "<D:href xmlns:D='DAV:'>" + subjectUri + "</D:href>";
               
               descriptor.setProperty("group-member-set","DAV:",value);
               nat.begin();
  -            content.store(slideToken,groupUri,descriptor,null);
  +            content.store(slideToken,objectUri,descriptor,null);
               nat.commit();
           }
           catch (ObjectNotFoundException e) {
  @@ -305,24 +273,19 @@
           }
       }
       
  -    public static void removeGroupMember(NamespaceAccessToken nat,
  -                                         String caller,
  -                                         String groupname,
  -                                         String username) throws Exception {
  -        
  -        String groupsPath = nat.getNamespaceConfig().getGroupsPath();
  -        String groupUri = groupsPath + "/" + groupname;
  -        String usersPath = nat.getNamespaceConfig().getUsersPath();
  -        String userUri = usersPath + "/" + username;
  +    public static void removeMember(NamespaceAccessToken nat,
  +                                    String caller,
  +                                    String objectUri,
  +                                    String subjectUri) throws Exception {
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Content content = nat.getContentHelper();
           
           try {
               
  -            NodeRevisionDescriptors descriptors = content.retrieve(slideToken,groupUri);
  -            NodeRevisionDescriptor descriptor = content.retrieve(slideToken,descriptors);
  -            NodeProperty property = descriptor.getProperty("group-member-set","DAV:");
  +            NodeRevisionDescriptors revisions = content.retrieve(slideToken,objectUri);
  +            NodeRevisionDescriptor revision = content.retrieve(slideToken,revisions);
  +            NodeProperty property = revision.getProperty("group-member-set","DAV:");
               
               if (property == null) {
                   // group has no members
  @@ -330,20 +293,20 @@
               }
               String value = (String) property.getValue();
               
  -            int index = value.indexOf(userUri);
  +            int index = value.indexOf(subjectUri);
               if (index == -1) {
  -                // user is not a member of this group
  +                // subject is not a member of this group
                   return;
               }
               
  -            // looking for the end of </D:href> after userUri
  -            int end = index + userUri.length();
  +            // looking for the end of </D:href> after subjectUri
  +            int end = index + subjectUri.length();
               do {
                   end++;
               } 
               while (value.charAt(end) != '>');
               
  -            // looking for the start of <D:href> before userUri
  +            // looking for the start of <D:href> before subjectUri
               int from = index;
               do {
                   from--;
  @@ -355,9 +318,9 @@
               String after  = value.substring(end+1);
               value = before + after;
               
  -            descriptor.setProperty("group-member-set","DAV:",value);
  +            revision.setProperty("group-member-set","DAV:",value);
               nat.begin();
  -            content.store(slideToken,groupUri,descriptor,null);
  +            content.store(slideToken,objectUri,revision,null);
               nat.commit();
           }
           catch (ObjectNotFoundException e) {
  @@ -373,40 +336,109 @@
               throw e;
           }
       }
  -    
  +        
       public static List listPermissions(NamespaceAccessToken nat,
                                          String caller,
                                          String path) throws Exception {
  -        String filesPath = nat.getNamespaceConfig().getFilesPath();
  -        String uri = filesPath + "/" + path;
  +                                           
  +        String uri = getUriFromPath(nat,path);
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Security security = nat.getSecurityHelper();
           
           List result = new ArrayList();
  -        Enumeration permissions = security.enumeratePermissions(slideToken,uri,false);
  -        while (permissions.hasMoreElements()) {
  -            result.add(permissions.nextElement());
  +        try {
  +            nat.begin();
  +            Enumeration permissions = security.enumeratePermissions(slideToken,uri,false);
  +            while (permissions.hasMoreElements()) {
  +                result.add(permissions.nextElement());
  +            }
  +            nat.commit();
  +            return result;
  +        }
  +        catch (Exception e) {
  +            try {
  +                nat.rollback();
  +            }
  +            catch (Exception f) {
  +                f.printStackTrace();
  +            }
  +            throw e;
           }
  -        return result;
       }
       
  -    public static List listUsers(NamespaceAccessToken nat,
  -                                      String caller) throws Exception {
  -        return listObjects(nat,caller,nat.getNamespaceConfig().getUsersPath());
  +    public static List listLocks(NamespaceAccessToken nat,
  +                                 String caller,
  +                                 String path) throws Exception {
  +
  +        String uri = getUriFromPath(nat,path);
  +        
  +        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
  +        Lock lock = nat.getLockHelper();
  +        
  +        List result = new ArrayList();
  +        try {
  +            nat.begin();
  +            Enumeration locks = lock.enumerateLocks(slideToken,uri,false);
  +            while(locks.hasMoreElements()) {
  +                result.add(locks.nextElement());
  +            }
  +            nat.commit();
  +            return result;
  +        } catch (Exception e) {
  +            try {
  +                nat.rollback();
  +            }
  +            catch (Exception f) {
  +                f.printStackTrace();
  +            }
  +            throw e;
  +        }
       }
       
  -    public static List listRoles(NamespaceAccessToken nat,
  -                                 String caller) throws Exception {
  -        return listObjects(nat,caller,nat.getNamespaceConfig().getRolesPath());
  +    public static List listGroups(NamespaceAccessToken nat, String caller, String path) throws Exception {
  +        List result = new ArrayList();
  +
  +        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
  +        Structure structure = nat.getStructureHelper();
  +        Content content = nat.getContentHelper();
  +        
  +        ObjectNode object = structure.retrieve(slideToken,path);
  +        Enumeration enum = structure.getChildren(slideToken,object);
  +        while (enum.hasMoreElements()) {
  +            String uri = ((ObjectNode) enum.nextElement()).getUri();
  +            NodeRevisionDescriptors revisions = content.retrieve(slideToken, uri);
  +            NodeRevisionDescriptor revision = content.retrieve(slideToken, revisions);
  +            NodeProperty property = revision.getProperty("group-member-set","DAV:");
  +            List members;
  +            if (property != null) {
  +                String value = (String) property.getValue();
  +                members = new ArrayList(10);
  +                int start = value.indexOf('>'), end = 0;
  +                while (start != -1) {
  +                    end = value.indexOf('<',start);
  +                    if (end != -1) {
  +                        members.add(value.substring(start+1,end));
  +                    }
  +                    end = value.indexOf('>',start+1);
  +                    start = value.indexOf('>',end+1);
  +                }
  +            }
  +            else {
  +                members = Collections.EMPTY_LIST;
  +            }
  +            result.add(new Group(uri,members));
  +        }
  +
  +        return result;
       }
       
  -    public static List listGroups(NamespaceAccessToken nat,
  -                                  String caller) throws Exception {
  -        return listObjects(nat,caller,nat.getNamespaceConfig().getGroupsPath());
  +    public static List listUsers(NamespaceAccessToken nat,
  +                                 String caller) throws Exception {
  +        return listObjects(nat,caller,nat.getNamespaceConfig().getUsersPath());
       }
       
  -    public static List listActions(NamespaceAccessToken nat,
  +    public static List listPrivileges(NamespaceAccessToken nat,
                                      String caller) throws Exception {
           return listObjects(nat,caller,nat.getNamespaceConfig().getActionsPath());
       }
  @@ -423,7 +455,7 @@
           ObjectNode object = structure.retrieve(slideToken,path);
           Enumeration enum = structure.getChildren(slideToken,object);
           while (enum.hasMoreElements()) {
  -            result.add(enum.nextElement());
  +            result.add(((ObjectNode) enum.nextElement()).getUri());
           }
           
           return result;
  @@ -435,20 +467,7 @@
                                           String subject,
                                           String action) throws Exception {
   
  -        String filesPath = nat.getNamespaceConfig().getFilesPath();
  -        String uri;
  -        if (path.equals("/")) {
  -            uri = filesPath;
  -        }
  -        else {
  -            uri = filesPath + "/" + path;
  -        }
  -        
  -        
  -        System.out.println("uri: " + uri);
  -        System.out.println("subject: " + subject);
  -        System.out.println("action: " + action);
  -        System.out.println("caller: " + caller);
  +        String uri = getUriFromPath(nat,path);
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Security security = nat.getSecurityHelper();
  @@ -478,14 +497,8 @@
                                        String action,
                                        String inheritable,
                                        String negative) throws Exception {
  -        String filesPath = nat.getNamespaceConfig().getFilesPath();
  -        String uri;
  -        if (path.equals("/")) {
  -            uri = filesPath;
  -        }
  -        else {
  -            uri = filesPath + "/" + path;
  -        }
  +                                         
  +        String uri = getUriFromPath(nat,path);
           
           SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
           Security security = nat.getSecurityHelper();
  @@ -512,6 +525,98 @@
                   f.printStackTrace();
               }
               throw e;
  +        }
  +    }
  +    
  +    public static void removeLock(NamespaceAccessToken nat,
  +                                  String caller,
  +                                  String uri,
  +                                  String lockId) throws Exception {
  +        
  +        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
  +        Lock lock = nat.getLockHelper();
  +        
  +        try {
  +            nat.begin();
  +            lock.unlock(slideToken,uri,lockId);
  +            nat.commit();
  +        }
  +        catch (Exception e) {
  +            try {
  +                nat.rollback();
  +            }
  +            catch (Exception f) {
  +                f.printStackTrace();
  +            }
  +            throw e;
  +        }
  +    }
  +    
  +    public static void addLock(NamespaceAccessToken nat,
  +                               String caller,
  +                               String path,
  +                               String subject,
  +                               String type,
  +                               String exclusive,
  +                               String inherit) throws Exception {
  +
  +       String uri = getUriFromPath(nat,path);
  +       boolean isExclusive = Boolean.valueOf(exclusive).booleanValue();
  +       boolean isInherit = Boolean.valueOf(inherit).booleanValue();
  +       // expires after one minute
  +       Date expire = new Date(System.currentTimeMillis() + 1000*60);
  +       
  +       SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
  +       Lock lock = nat.getLockHelper();
  +       
  +       try {
  +           nat.begin();
  +           lock.lock(slideToken,new NodeLock(uri,subject,type,expire,isExclusive,isInherit));
  +           nat.commit();
  +       }
  +       catch (Exception e) {
  +           try {
  +               nat.rollback();
  +           }
  +           catch (Exception f) {
  +               f.printStackTrace();
  +           }
  +           throw e;
  +       }
  +    }
  +    
  +    private static String getUriFromPath(NamespaceAccessToken nat,
  +                                         String path) {
  +        String filesPath = nat.getNamespaceConfig().getFilesPath();
  +        String uri;
  +        if (path.equals("/") || path.length() == 0) {
  +            uri = filesPath;
  +        }
  +        else {
  +            uri = filesPath + "/" + path;
  +        }
  +        return uri;
  +    }
  +    
  +    public static class Group {
  +        private final String m_uri;
  +        private final List m_members;
  +        
  +        private Group(String uri, List members) {
  +            m_uri = uri;
  +            m_members = members;
  +        }
  +        
  +        public String getUri() {
  +            return m_uri;
  +        }
  +        
  +        public List getMembers() {
  +            return m_members;
  +        }
  +        
  +        public String toString() {
  +            return m_uri;
           }
       }
   }
  
  
  

Mime
View raw message