stephan 2002/07/02 09:54:25 Modified: src/scratchpad/src/org/apache/cocoon/acting SourceUploadAction.java src/scratchpad/src/org/apache/cocoon/components/source/helpers SourcePermission.java src/scratchpad/src/org/apache/cocoon/components/source/impl GIFSourceInspector.java SlideSource.java SlideSourceFactory.java SourceInspectorManager.java src/scratchpad/src/org/apache/cocoon/generation SourceDescriptionGenerator.java src/scratchpad/webapp/samples/slide rdf2html.xsl sitemap.xmap slide.xconf Added: src/scratchpad/src/org/apache/cocoon/components/source/helpers AbstractSourcePermission.java GroupSourcePermission.java UserSourcePermission.java src/scratchpad/webapp/samples/slide rdf2html4properties.xsl Log: Separate the permission into user & group permissions. Finished the SourceInspector, which now works. Change the stylesheet to make the look closer the other cocoon sites. Revision Changes Path 1.2 +20 -8 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceUploadAction.java Index: SourceUploadAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceUploadAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SourceUploadAction.java 27 Jun 2002 16:53:37 -0000 1.1 +++ SourceUploadAction.java 2 Jul 2002 16:54:25 -0000 1.2 @@ -61,7 +61,9 @@ import org.apache.cocoon.ProcessingException; import org.apache.cocoon.acting.AbstractAction; import org.apache.cocoon.components.request.multipart.FilePartFile; +import org.apache.cocoon.components.source.RestrictableSource; import org.apache.cocoon.components.source.WriteableSource; +import org.apache.cocoon.components.source.helpers.SourceCredential; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.Request; @@ -124,13 +126,29 @@ String uri = parameters.getParameter("uri", request.getParameter("uri")); String filename = parameters.getParameter("filename", request.getParameter("filename")); + String principal = parameters.getParameter("cocoon-source-principal", + request.getParameter("cocoon-source-principal")); + String password = parameters.getParameter("cocoon-source-password", + request.getParameter("cocoon-source-password")); if ((request.get("file")!=null) && (request.get("file") instanceof FilePartFile)) { File uploadFile = ((FilePartFile)request.get("file")).getFile(); try { - Source source = resolver.resolveURI(uri+"/"+filename); + if ((uri==null) || (uri.length()==0)) + uri = filename; + else if (uri.endsWith("/")) + uri = uri+filename; + else + uri = uri+"/"+filename; + + System.out.println("uri="+uri); + + Source source = resolver.resolveURI(uri); + + if (source instanceof RestrictableSource) + ((RestrictableSource)source).setSourceCredential(new SourceCredential(principal, password)); if (source instanceof WriteableSource) { WriteableSource writeablesource = (WriteableSource)source; @@ -156,12 +174,6 @@ throw new ProcessingException("Exception occurs while storing the content", ioe); } } - - /*System.out.println("file="+uploadFile); - - String[] filelist = uploadDir.list(); - for (int i = 0; i < filelist.length; i++) - System.out.println("File [" + i + "]=" + filelist[i]);*/ return null; } 1.4 +9 -65 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourcePermission.java Index: SourcePermission.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourcePermission.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SourcePermission.java 1 Jul 2002 16:41:55 -0000 1.3 +++ SourcePermission.java 2 Jul 2002 16:54:25 -0000 1.4 @@ -56,16 +56,12 @@ package org.apache.cocoon.components.source.helpers; /** - * This class represents a permission for a source + * This interface represents a permission for a source * * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @version $Id$ */ -public class SourcePermission { - - public final static String PRINCIPAL_SELF = "self"; - public final static String PRINCIPAL_ALL = "all"; - public final static String PRINCIPAL_GUEST = "guest"; +public interface SourcePermission { public final static String PRIVILEGE_ALL = "all"; public final static String PRIVILEGE_READ = "read"; @@ -94,97 +90,45 @@ public final static String PRIVILEGE_GRANT_PERMISSION = "grant-permission"; public final static String PRIVILEGE_REVOKE_PERMISSION = "revoke-permission"; - private String principal; - private String privilege; - private boolean inheritable; - private boolean negative; - - /** - * Creates a new permission - * - * @param principal Principal of the permission - * @param privilege Privilege of the permission - * @param inheritable If the permission is inheritable - * @param negative If the permission is negative - */ - public SourcePermission(String principal, String privilege, - boolean inheritable, boolean negative) { - - this.principal = principal; - this.privilege = privilege; - this.inheritable = inheritable; - this.negative = negative; - } - - /** - * Sets the principal of the permission - * - * @param principal Principal of the permission - */ - public void setPrincipal(String principal) { - this.principal = principal; - } - - /** - * Returns the principal of the permission - * - * @return Principal of the permission - */ - public String getPrincipal() { - return this.principal; - } - /** * Sets the privilege of the permission * * @param privilege Privilege of the permission */ - public void setPrivilege(String privilege) { - this.privilege = privilege; - } + public void setPrivilege(String privilege); /** * Returns the privilege of the permission * * @return Privilege of the permission */ - public String getPrivilege() { - return this.privilege; - } + public String getPrivilege(); /** * Sets the inheritable flag * * @param inheritable If the permission is inheritable */ - public void setInheritable(boolean inheritable) { - this.inheritable = inheritable; - } + public void setInheritable(boolean inheritable); /** * Returns the inheritable flag * * @return If the permission is inheritable */ - public boolean isInheritable() { - return this.inheritable; - } + public boolean isInheritable(); /** * Sets the negative flag * * @param negative If the permission is a negative permission */ - public void setNegative(boolean negative) { - this.negative = negative; - } + public void setNegative(boolean negative); /** * Returns the negative flag * * @return If the permission is a negative permission */ - public boolean isNegative() { - return this.negative; - } + public boolean isNegative(); } 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/AbstractSourcePermission.java Index: AbstractSourcePermission.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache Cocoon" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.cocoon.components.source.helpers; /** * This class is an abstract implementation of a source permission * * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @version $Id: AbstractSourcePermission.java,v 1.1 2002/07/02 16:54:25 stephan Exp $ */ public abstract class AbstractSourcePermission implements SourcePermission{ private String privilege; private boolean inheritable; private boolean negative; /** * Sets the privilege of the permission * * @param privilege Privilege of the permission */ public void setPrivilege(String privilege) { this.privilege = privilege; } /** * Returns the privilege of the permission * * @return Privilege of the permission */ public String getPrivilege() { return this.privilege; } /** * Sets the inheritable flag * * @param inheritable If the permission is inheritable */ public void setInheritable(boolean inheritable) { this.inheritable = inheritable; } /** * Returns the inheritable flag * * @return If the permission is inheritable */ public boolean isInheritable() { return this.inheritable; } /** * Sets the negative flag * * @param negative If the permission is a negative permission */ public void setNegative(boolean negative) { this.negative = negative; } /** * Returns the negative flag * * @return If the permission is a negative permission */ public boolean isNegative() { return this.negative; } } 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/GroupSourcePermission.java Index: GroupSourcePermission.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache Cocoon" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.cocoon.components.source.helpers; /** * This class represents a source permission for groups * * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @version $Id: GroupSourcePermission.java,v 1.1 2002/07/02 16:54:25 stephan Exp $ */ public class GroupSourcePermission extends AbstractSourcePermission { private String group; /** * Creates a new permission * * @param principal Principal of the permission * @param privilege Privilege of the permission * @param inheritable If the permission is inheritable * @param negative If the permission is negative */ public GroupSourcePermission(String group, String privilege, boolean inheritable, boolean negative) { this.group = group; setPrivilege(privilege); setInheritable(inheritable); setNegative(negative); } /** * Sets the group of users for the permission * * @param group Group of users */ public void setGroup(String group) { this.group = group; } /** * Returns the group of users for the permission * * @return Group of users */ public String getGroup() { return this.group; } } 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/UserSourcePermission.java Index: UserSourcePermission.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache Cocoon" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.cocoon.components.source.helpers; /** * This class represents a source permission for users * * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a> * @version $Id: UserSourcePermission.java,v 1.1 2002/07/02 16:54:25 stephan Exp $ */ public class UserSourcePermission extends AbstractSourcePermission { public final static String PRINCIPAL_SELF = "SELF"; public final static String PRINCIPAL_ALL = "ALL"; public final static String PRINCIPAL_GUEST = "GUEST"; private String principal; /** * Creates a new permission * * @param principal Principal of the permission * @param privilege Privilege of the permission * @param inheritable If the permission is inheritable * @param negative If the permission is negative */ public UserSourcePermission(String principal, String privilege, boolean inheritable, boolean negative) { this.principal = principal; setPrivilege(privilege); setInheritable(inheritable); setNegative(negative); } /** * Sets the principal of the permission * * @param principal Principal of the permission */ public void setPrincipal(String principal) { this.principal = principal; } /** * Returns the principal of the permission * * @return Principal of the permission */ public String getPrincipal() { return this.principal; } } 1.2 +2 -1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/GIFSourceInspector.java Index: GIFSourceInspector.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/GIFSourceInspector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- GIFSourceInspector.java 29 Jun 2002 21:04:11 -0000 1.1 +++ GIFSourceInspector.java 2 Jul 2002 16:54:25 -0000 1.2 @@ -109,6 +109,7 @@ if ((source.getSystemId().endsWith(".gif")) && (isGIFFile(source))) { + int[] size = getGifSize(source); return new SourceProperty[] { new SourceProperty(PROPERTY_NS, IMAGE_WIDTH_PROPERTY_NAME, String.valueOf(size[0])), 1.9 +118 -63 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java Index: SlideSource.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SlideSource.java 1 Jul 2002 16:41:55 -0000 1.8 +++ SlideSource.java 2 Jul 2002 16:54:25 -0000 1.9 @@ -73,10 +73,12 @@ import org.apache.cocoon.components.source.TraversableSource; import org.apache.cocoon.components.source.WriteableSource; import org.apache.cocoon.components.source.VersionableSource; +import org.apache.cocoon.components.source.helpers.GroupSourcePermission; import org.apache.cocoon.components.source.helpers.SourceCredential; import org.apache.cocoon.components.source.helpers.SourceLock; import org.apache.cocoon.components.source.helpers.SourcePermission; import org.apache.cocoon.components.source.helpers.SourceProperty; +import org.apache.cocoon.components.source.helpers.UserSourcePermission; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; @@ -107,6 +109,7 @@ //import org.apache.slide.security.AccessDeniedException; import org.apache.slide.security.NodePermission; import org.apache.slide.security.Security; +import org.apache.slide.structure.GroupNode; import org.apache.slide.structure.ObjectNode; import org.apache.slide.structure.ObjectNotFoundException; import org.apache.slide.structure.Structure; @@ -144,6 +147,9 @@ /** Namespace access token. */ private NamespaceAccessToken nat; + /** Configuration of namespace */ + private NamespaceConfig config; + /** Structure helper. */ private Structure structure; @@ -195,8 +201,14 @@ this.credToken = new CredentialsToken(this.sourcecredential.getPrincipal()); this.nat = nat; + this.config = this.nat.getNamespaceConfig(); this.protocol = protocol; this.uri = uri; + if ((this.uri==null) || (this.uri.length()==0)) + this.uri = "/"; + else if (!this.uri.startsWith("/")) + this.uri = "/"+this.uri; + this.systemid = protocol+":/"+uri; // FIXME dirty hack this.sourcerevision = sourcerevision; this.sourcerevisionbranch = sourcerevisionbranch; @@ -239,7 +251,7 @@ public void initialize() throws Exception { try { - this.revisionDescriptors = content.retrieve(this.slideToken, this.uri); + this.revisionDescriptors = content.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); // Retrieve latest revision descriptor this.revisionDescriptor = content.retrieve(slideToken, revisionDescriptors); @@ -270,7 +282,7 @@ public InputStream getInputStream() throws IOException, SourceException { try { - ObjectNode object = structure.retrieve(this.slideToken, this.uri); + ObjectNode object = structure.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); return content.retrieve(slideToken, this.revisionDescriptors, this.revisionDescriptor).streamContent(); @@ -330,7 +342,7 @@ */ public boolean exists() { try { - structure.retrieve(this.slideToken, this.uri); + structure.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); } catch (SlideException e) { return false; } @@ -396,7 +408,7 @@ if (revisionDescriptor==null) { revisionDescriptor = new NodeRevisionDescriptor(0); - String resourceName = uri; + String resourceName = config.getFilesPath()+uri; int lastSlash = resourceName.lastIndexOf('/'); if (lastSlash != -1) resourceName = resourceName.substring(lastSlash + 1); @@ -411,8 +423,8 @@ //nat.begin(); if (revisionNumber==null) - content.create(slideToken, uri, revisionDescriptor, null); - content.store(slideToken, uri, revisionDescriptor, + content.create(slideToken, config.getFilesPath()+uri, revisionDescriptor, null); + content.store(slideToken, config.getFilesPath()+uri, revisionDescriptor, revisionContent); //nat.commit(); @@ -424,7 +436,7 @@ try { // Creating an object - structure.create(slideToken, subject, uri); + structure.create(slideToken, subject, config.getFilesPath()+uri); } catch (SlideException se) { // FIXME correct exception handling e.printStackTrace(); @@ -467,7 +479,7 @@ revisionContent.setContent(bytes); try { - content.create(slideToken, uri, revisionDescriptor, + content.create(slideToken, config.getFilesPath()+uri, revisionDescriptor, revisionContent); } catch (SlideException se) { // FIXME correct exception handling @@ -583,8 +595,9 @@ try { int i=0; for(Enumeration children=structure.retrieve(this.slideToken, - this.uri).enumerateChildren(); children.hasMoreElements();i++) - children.nextElement(); + this.config.getFilesPath()+this.uri).enumerateChildren(); children.hasMoreElements();) + if (((String)children.nextElement()).startsWith(this.config.getFilesPath())) + i++; return i; } catch (SlideException se) { throw new SourceException("Could not get children", se); @@ -601,11 +614,16 @@ int i=0; String child; for(Enumeration children=structure.retrieve(this.slideToken, - this.uri).enumerateChildren(); children.hasMoreElements();i++) { + this.config.getFilesPath()+this.uri).enumerateChildren(); children.hasMoreElements();) { child = (String)children.nextElement(); - if (i==index) - return protocol+":/"+child; + + if (child.startsWith(this.config.getFilesPath())) { + if (i==index) + return protocol+":/"+child.substring(this.config.getFilesPath().length()); + + i++; + } } return null; } catch (SlideException se) { @@ -642,6 +660,7 @@ throw new NullPointerException(); this.sourcecredential = sourcecredential; this.credToken = new CredentialsToken(this.sourcecredential.getPrincipal()); + this.slideToken = new SlideTokenImpl(credToken); } /** @@ -655,73 +674,101 @@ NamespaceConfig config = this.nat.getNamespaceConfig(); - String principal = config.getUsersPath()+"/"+sourcepermission.getPrincipal(); + String subject = null; + if (sourcepermission instanceof UserSourcePermission) { + subject = config.getUsersPath()+((UserSourcePermission)sourcepermission).getPrincipal(); + + // Test if user exists + try { + ObjectNode objectnode = structure.retrieve(this.slideToken, subject); + if (!(objectnode instanceof SubjectNode)) + return; + } catch (SlideException e) { + return; + } + + } else if (sourcepermission instanceof GroupSourcePermission) { + subject = config.getUsersPath()+((GroupSourcePermission)sourcepermission).getGroup(); + + // Test if group exists + try { + ObjectNode objectnode = structure.retrieve(this.slideToken, subject); + if (!(objectnode instanceof GroupNode)) + return; + } catch (SlideException e) { + return; + } + + subject = "+"+subject; // Additional '+' to expand the group + } else + return; // If not user or group + boolean negative = sourcepermission.isNegative(); boolean inheritable = sourcepermission.isInheritable(); if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_ALL)) { - addPermission(principal, "/", negative, inheritable); + addPermission(subject, "/", negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ)) { - addPermission(principal, config.getReadObjectAction().getUri(), negative, inheritable); - addPermission(principal, config.getReadLocksAction().getUri(), negative, inheritable); - addPermission(principal, config.getReadRevisionMetadataAction().getUri(), negative, inheritable); - addPermission(principal, config.getReadRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadLocksAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ_SOURCE)) { - addPermission(principal, config.getReadObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadObjectAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ_LOCKS)) { - addPermission(principal, config.getReadLocksAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadLocksAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ_PROPERTY)) { - addPermission(principal, config.getReadRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadRevisionMetadataAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ_CONTENT)) { - addPermission(principal, config.getReadRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_WRITE)) { - addPermission(principal, config.getCreateObjectAction().getUri(), negative, inheritable); - addPermission(principal, config.getRemoveObjectAction().getUri(), negative, inheritable); - addPermission(principal, config.getLockObjectAction().getUri(), negative, inheritable); - addPermission(principal, config.getCreateRevisionMetadataAction().getUri(), negative, inheritable); - addPermission(principal, config.getModifyRevisionMetadataAction().getUri(), negative, inheritable); - addPermission(principal, config.getRemoveRevisionMetadataAction().getUri(), negative, inheritable); - addPermission(principal, config.getCreateRevisionContentAction().getUri(), negative, inheritable); - addPermission(principal, config.getModifyRevisionContentAction().getUri(), negative, inheritable); - addPermission(principal, config.getRemoveRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getLockObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getModifyRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getModifyRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_CREATE_SOURCE)) { - addPermission(principal, config.getCreateObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateObjectAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_REMOVE_SOURCE)) { - addPermission(principal, config.getRemoveObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveObjectAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_LOCK_SOURCE)) { - addPermission(principal, config.getLockObjectAction().getUri(), negative, inheritable); + addPermission(subject, config.getLockObjectAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_CREATE_PROPERTY)) { - addPermission(principal, config.getCreateRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateRevisionMetadataAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_MODIFY_PROPERTY)) { - addPermission(principal, config.getModifyRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getModifyRevisionMetadataAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_REMOVE_PROPERTY)) { - addPermission(principal, config.getRemoveRevisionMetadataAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveRevisionMetadataAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_CREATE_CONTENT)) { - addPermission(principal, config.getCreateRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getCreateRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_MODIFY_CONTENT)) { - addPermission(principal, config.getModifyRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getModifyRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_REMOVE_CONTENT)) { - addPermission(principal, config.getRemoveRevisionContentAction().getUri(), negative, inheritable); + addPermission(subject, config.getRemoveRevisionContentAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_READ_ACL)) { - addPermission(principal, config.getReadPermissionsAction().getUri(), negative, inheritable); + addPermission(subject, config.getReadPermissionsAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_WRITE_ACL)) { - addPermission(principal, config.getGrantPermissionAction().getUri(), negative, inheritable); - addPermission(principal, config.getRevokePermissionAction().getUri(), negative, inheritable); + addPermission(subject, config.getGrantPermissionAction().getUri(), negative, inheritable); + addPermission(subject, config.getRevokePermissionAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_GRANT_PERMISSION)) { - addPermission(principal, config.getGrantPermissionAction().getUri(), negative, inheritable); + addPermission(subject, config.getGrantPermissionAction().getUri(), negative, inheritable); } else if (sourcepermission.getPrivilege().equals(SourcePermission.PRIVILEGE_REVOKE_PERMISSION)) { - addPermission (principal, config.getRevokePermissionAction().getUri(), negative, inheritable); + addPermission (subject, config.getRevokePermissionAction().getUri(), negative, inheritable); } } /** * Add permission to the list of permissions to set. */ - private void addPermission(String principal, String action, + private void addPermission(String subject, String action, boolean negative, boolean inheritable) throws SourceException { try { NodePermission permission = new NodePermission - (this.uri, principal, action, inheritable, negative); + (this.config.getFilesPath()+this.uri, subject, action, inheritable, negative); this.security.grantPermission(this.slideToken, permission); } catch (SlideException se) { getLogger().warn("Couldn't grant permission", se); @@ -740,7 +787,7 @@ NamespaceConfig config = this.nat.getNamespaceConfig(); - ObjectNode current = structure.retrieve(this.slideToken, this.uri); + ObjectNode current = structure.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); security.checkCredentials(this.slideToken, current, config.getReadPermissionsAction()); @@ -892,18 +939,26 @@ boolean isAll = isRead && isWrite && isReadAcl && isWriteAcl; - - SourcePermission sourcepermission = new SourcePermission(null, null, - inheritedPermissions, negative); + SourcePermission sourcepermission = null; if (principal.equals("~")) - sourcepermission.setPrincipal(SourcePermission.PRINCIPAL_SELF); + sourcepermission = new UserSourcePermission(UserSourcePermission.PRINCIPAL_SELF, null, + inheritedPermissions, negative); else if (principal.equals("nobody")) - sourcepermission.setPrincipal(SourcePermission.PRINCIPAL_GUEST); + sourcepermission = new UserSourcePermission(UserSourcePermission.PRINCIPAL_GUEST, null, + inheritedPermissions, negative); + else if (principal.equals(userspath)) + sourcepermission = new UserSourcePermission(UserSourcePermission.PRINCIPAL_ALL, null, + inheritedPermissions, negative); else if (principal.startsWith(userspath+"/")) - sourcepermission.setPrincipal(principal.substring(userspath.length()+1)); + sourcepermission = new UserSourcePermission(principal.substring(userspath.length()+1), null, + inheritedPermissions, negative); + else if (principal.startsWith("+"+userspath+"/")) + sourcepermission = new GroupSourcePermission(principal.substring(userspath.length()+2), null, + inheritedPermissions, negative); else - sourcepermission.setPrincipal(principal); + sourcepermission = new UserSourcePermission(principal, null, + inheritedPermissions, negative); if (isAll) { sourcepermission.setPrivilege(SourcePermission.PRIVILEGE_ALL); @@ -1001,7 +1056,7 @@ Vector sourcelocks = new Vector(); NodeLock lock; - for(Enumeration locks = this.lock.enumerateLocks(this.slideToken, this.uri, false); + for(Enumeration locks = this.lock.enumerateLocks(this.slideToken, this.config.getFilesPath()+this.uri, false); locks.hasMoreElements();) { lock = (NodeLock) locks.nextElement(); @@ -1030,7 +1085,7 @@ try { revisionDescriptor.setProperty(sourceproperty.getName(), sourceproperty.getNamespace(), sourceproperty.getValueAsString()); - content.store(slideToken, this.uri, revisionDescriptor, null); + content.store(slideToken, this.config.getFilesPath()+this.uri, revisionDescriptor, null); } catch (SlideException se) { throw new SourceException("Could not set property", se); } @@ -1080,7 +1135,7 @@ try { if (revisionDescriptor!=null) { revisionDescriptor.removeProperty(name,namespace); - content.store(slideToken, this.uri, revisionDescriptor, null); + content.store(slideToken, this.config.getFilesPath()+this.uri, revisionDescriptor, null); } } catch (SlideException se) { throw new SourceException("Could not remove property", se); @@ -1092,7 +1147,7 @@ */ public boolean isVersioned() throws SourceException { try { - this.revisionDescriptors = content.retrieve(this.slideToken, this.uri); + this.revisionDescriptors = content.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); return this.revisionDescriptors.hasRevisions(); @@ -1115,7 +1170,7 @@ this.sourcerevision = sourcerevision; try { - this.revisionDescriptors = content.retrieve(this.slideToken, this.uri); + this.revisionDescriptors = content.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); // Retrieve revision descriptor by the revision this.revisionDescriptor = content.retrieve(slideToken, revisionDescriptors, @@ -1147,7 +1202,7 @@ */ public String getLatestSourceRevision() throws SourceException { try { - this.revisionDescriptors = content.retrieve(this.slideToken, this.uri); + this.revisionDescriptors = content.retrieve(this.slideToken, this.config.getFilesPath()+this.uri); return this.revisionDescriptors.getLatestRevision().toString(); 1.2 +7 -7 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java Index: SlideSourceFactory.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SlideSourceFactory.java 26 Jun 2002 15:08:16 -0000 1.1 +++ SlideSourceFactory.java 2 Jul 2002 16:54:25 -0000 1.2 @@ -141,12 +141,12 @@ locationParameters = new SourceParameters(); } - String repository = locationParameters.getParameter("repository", null); - String namespace = locationParameters.getParameter("namespace", null); - String principal = locationParameters.getParameter("principal", "guest"); - String password = locationParameters.getParameter("password", null); - String revision = locationParameters.getParameter("revision", null); - String branch = locationParameters.getParameter("branch", null); + String repository = locationParameters.getParameter("cocoon-repository", null); + String namespace = locationParameters.getParameter("cocoon-repository-namespace", null); + String principal = locationParameters.getParameter("cocoon-source-principal", "guest"); + String password = locationParameters.getParameter("cocoon-source-password", null); + String revision = locationParameters.getParameter("cocoon-source-revision", null); + String branch = locationParameters.getParameter("cocoon-source-branch", null); SourceCredential credential; if (password!=null) 1.3 +2 -2 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SourceInspectorManager.java Index: SourceInspectorManager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SourceInspectorManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SourceInspectorManager.java 29 Jun 2002 21:04:11 -0000 1.2 +++ SourceInspectorManager.java 2 Jul 2002 16:54:25 -0000 1.3 @@ -120,7 +120,7 @@ ClassLoader classloader = Thread.currentThread().getContextClassLoader(); - final Configuration[] configurations = configuration.getChildren("inspector"); + final Configuration[] configurations = configuration.getChildren("sourceinspector"); for(int i=0; i<configurations.length; i++) { String className = configurations[i].getAttribute( "class", "" ); 1.7 +30 -5 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java Index: SourceDescriptionGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- SourceDescriptionGenerator.java 1 Jul 2002 16:41:55 -0000 1.6 +++ SourceDescriptionGenerator.java 2 Jul 2002 16:54:25 -0000 1.7 @@ -72,10 +72,12 @@ import org.apache.cocoon.components.source.SourceInspector; import org.apache.cocoon.components.source.WriteableSource; import org.apache.cocoon.components.source.VersionableSource; +import org.apache.cocoon.components.source.helpers.GroupSourcePermission; import org.apache.cocoon.components.source.helpers.SourceCredential; import org.apache.cocoon.components.source.helpers.SourceLock; import org.apache.cocoon.components.source.helpers.SourcePermission; import org.apache.cocoon.components.source.helpers.SourceProperty; +import org.apache.cocoon.components.source.helpers.UserSourcePermission; //import org.apache.cocoon.environment.Source; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.xml.EmbeddedXMLPipe; @@ -126,11 +128,13 @@ private static final String PERMISSION_NODE_NAME = "permission"; private static final String LOCKS_NODE_NAME = "locks"; private static final String LOCK_NODE_NAME = "lock"; + private static final String PARENT_NODE_NAME = "parent"; private static final String CHILDREN_NODE_NAME = "children"; private static final String URI_ATTR_NAME = "about"; private static final String PRINCIPAL_ATTR_NAME = "principal"; + private static final String GROUP_ATTR_NAME = "group"; private static final String PRIVILEGE_ATTR_NAME = "privilege"; private static final String INHERITABLE_ATTR_NAME = "inheritable"; private static final String NEGATIVE_ATTR_NAME = "negative"; @@ -291,8 +295,23 @@ if (source instanceof LockableSource) pushSourceLocks((LockableSource)source); - if ((source instanceof TraversableSource) && (deep>0)) - pushSourceChilds((TraversableSource)source, deep); + if (source instanceof TraversableSource) { + + TraversableSource traversablesource = (TraversableSource)source; + + if (traversablesource.getParent()!=null) { + this.contentHandler.startElement(SOURCE_NS, PARENT_NODE_NAME, + SOURCE_PREFIX+":"+PARENT_NODE_NAME, new AttributesImpl()); + this.contentHandler.characters(traversablesource.getParent().toCharArray(), 0, + traversablesource.getParent().length()); + this.contentHandler.endElement(SOURCE_NS, PARENT_NODE_NAME, + SOURCE_PREFIX+":"+PARENT_NODE_NAME); + } + + if (deep>0) + pushSourceChilds(traversablesource, deep); + } + this.contentHandler.endElement(RDF_NS, DESCRIPTION_NODE_NAME, RDF_PREFIX+':'+DESCRIPTION_NODE_NAME); if ((source instanceof TraversableSource) && (deep>0)) { @@ -387,8 +406,14 @@ RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME, new AttributesImpl()); AttributesImpl attributes = new AttributesImpl(); - attributes.addAttribute("", PRINCIPAL_ATTR_NAME, PRINCIPAL_ATTR_NAME, "CDATA", - permissions[i].getPrincipal()); + + if (permissions[i] instanceof UserSourcePermission) + attributes.addAttribute("", PRINCIPAL_ATTR_NAME, PRINCIPAL_ATTR_NAME, "CDATA", + ((UserSourcePermission)permissions[i]).getPrincipal()); + else if (permissions[i] instanceof GroupSourcePermission) + attributes.addAttribute("", GROUP_ATTR_NAME, GROUP_ATTR_NAME, "CDATA", + ((GroupSourcePermission)permissions[i]).getGroup()); + attributes.addAttribute("", PRIVILEGE_ATTR_NAME, PRIVILEGE_ATTR_NAME, "CDATA", permissions[i].getPrivilege()); attributes.addAttribute("", INHERITABLE_ATTR_NAME, INHERITABLE_ATTR_NAME, "CDATA", 1.3 +79 -8 xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html.xsl Index: rdf2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- rdf2html.xsl 1 Jul 2002 16:41:55 -0000 1.2 +++ rdf2html.xsl 2 Jul 2002 16:54:25 -0000 1.3 @@ -30,11 +30,17 @@ </td> </tr> <tr> - <td colspan="3" bgcolor="#eeeeee"><a href="/cocoon/mount/slide/browse/">Home</a></td> + <td colspan="1" bgcolor="#eeeeee"><a href="/cocoon/samples/slide/browse/">Home</a></td> + <td colspan="2" bgcolor="#eeeeee"> + <xsl:if test="source:parent"> + <a href="/cocoon/samples/slide/browse/{substring-after(source:parent,'://')}">Back</a> + </xsl:if> + </td> + <td colspan="2" bgcolor="#eeeeee"> <xsl:if test="dav:getcontentlength!='' and dav:getcontentlength!='0'"> <xsl:if test="dav:resourcetype!='<collection/>'"> - <a href="/cocoon/mount/slide/view/{@rdf:about}">Download</a> + <a href="/cocoon/samples/slide/view/{@rdf:about}">Download</a> </xsl:if> </xsl:if> </td> @@ -82,7 +88,8 @@ </tr> <xsl:for-each select="*[local-name()!='children' and - local-name()!='permissions' and local-name()!='locks']"> + local-name()!='permissions' and local-name()!='locks' and + local-name()!='parent']"> <tr bgcolor="#eeeeee"> <td align="left"><tt><xsl:value-of select="namespace-uri(.)"/></tt></td> <td align="left"><tt><xsl:value-of select="local-name(.)"/></tt></td> @@ -139,13 +146,77 @@ <td align="right"></td> </tr> - <xsl:apply-templates select="source:permissions/rdf:Seq/rdf:li/source:permission"/> + <xsl:apply-templates select="source:permissions/rdf:Seq/rdf:li/source:permission[@principal]"/> <tr bgcolor="#eeeeee"> <form action="" method="post"> <input type="hidden" name="uri" value="{@rdf:about}"/> <td align="left"> - <input name="permissonprincipal" type="text" size="25" maxlength="40"/> + <select name="permissonprincipal"> + <option>ALL</option> + <option>SELF</option> + <option>GUEST</option> + </select> + </td> + <td align="left"> + <select name="permissonprivilege"> + <option>all</option> + <option>read</option> + <option>write</option> + <option>read-acl</option> + <option>write-acl</option> + <option>read-source</option> + <option>create-source</option> + <option>remove-source</option> + <option>lock-source</option> + <option>read-locks</option> + <option>read-property</option> + <option>create-property</option> + <option>modify-property</option> + <option>remove-property</option> + <option>read-content</option> + <option>create-content</option> + <option>modify-content</option> + <option>remove-content</option> + <option>grant-permission</option> + <option>revoke-permission</option> + </select> + </td> + <td align="left"> + <select name="permissoninheritable"> + <option>true</option> + <option>false</option> + </select> + </td> + <td align="left"> + <select name="permissondeny"> + <option>true</option> + <option>false</option> + </select> + </td> + <td align="right"> + <input type="submit" name="cocoon-action-addpermission" value="Add/Modify"/> + </td> + </form> + </tr> + + <tr bgcolor="#cccccc"> + <td align="left"><tt><b>Group</b></tt></td> + <td align="left"><tt><b>Privilege</b></tt></td> + <td align="left"><tt><b>Inheritable</b></tt></td> + <td align="left"><tt><b>Deny</b></tt></td> + <td align="right"></td> + </tr> + + <xsl:apply-templates select="source:permissions/rdf:Seq/rdf:li/source:permission[@group]"/> + + <tr bgcolor="#eeeeee"> + <form action="" method="post"> + <input type="hidden" name="uri" value="{@rdf:about}"/> + <td align="left"> + <select name="permissongroup"> + <option>groupA</option> + </select> </td> <td align="left"> <select name="permissonprivilege"> @@ -307,7 +378,7 @@ <xsl:template match="source:permission"> <tr bgcolor="#eeeeee"> - <td align="left"><tt><xsl:value-of select="@principal"/></tt></td> + <td align="left"><tt><xsl:value-of select="@principal"/><xsl:value-of select="@group"/></tt></td> <td align="left"><tt><xsl:value-of select="@privilege"/></tt></td> <td align="left"><tt><xsl:value-of select="@inheritable"/></tt></td> <td align="left"><tt><xsl:value-of select="@negative"/></tt></td> @@ -344,7 +415,7 @@ <xsl:template match="rdf:li" mode="enumerate"> <tr bgcolor="#eeeeee"> <td align="left">   - <a href="/cocoon/mount/slide/browse/{substring-after(@rdf:resource,'://')}" + <a href="/cocoon/samples/slide/browse/{substring-after(@rdf:resource,'://')}" ><tt><xsl:value-of select="@rdf:resource"/></tt></a> </td> <xsl:variable name="location"><xsl:value-of select="@rdf:resource"/></xsl:variable> @@ -364,7 +435,7 @@ <!-- <xsl:template match="rdf:Description" mode="enumerate"> <tr bgcolor="#eeeeee"> <td align="left">   - <a href="/cocoon/mount/slide/browse/{source:uri}"><tt><xsl:value-of select="source:uri"/></tt></a> + <a href="/cocoon/samples/slide/browse/{source:uri}"><tt><xsl:value-of select="source:uri"/></tt></a> </td> <td align="left"><tt></tt></td> <td align="left"><tt><xsl:value-of select="dav:getcontentlength"/></tt></td> 1.2 +6 -4 xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sitemap.xmap 1 Jul 2002 15:09:21 -0000 1.1 +++ sitemap.xmap 2 Jul 2002 16:54:25 -0000 1.2 @@ -147,15 +147,17 @@ <map:parameter name="handler" value="slidehandler"/>--> <map:match pattern="browse/**"> - <map:act set="slide-actions"/> + <map:act set="slide-actions"> + <map:parameter name="cocoon-source-principal" value="root"/> + </map:act> - <map:generate type="sourcedescription" src="slide://{1}?principal=root"> + <map:generate type="sourcedescription" src="slide://{1}?cocoon-source-principal=root"> <map:parameter name="repository" value="slide"/> <map:parameter name="namespace" value="myrepository"/> <map:parameter name="principal" value="root"/> </map:generate> - <map:transform src="rdf2html.xsl"> + <map:transform src="rdf2html4properties.xsl"> <map:parameter name="use-request-parameters" value="true"/> <!--<map:parameter name="namespace" value="{1}"/>--> </map:transform> @@ -164,7 +166,7 @@ </map:match> <map:match pattern="view/**"> - <map:read src="slide://{1}?repository=slide&namespace=myrepository&principal=root"/> + <map:read src="slide://{1}?cocoon-source-principal=root"/> </map:match> <!-- </map:act> 1.3 +5 -5 xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf Index: slide.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- slide.xconf 1 Jul 2002 16:41:55 -0000 1.2 +++ slide.xconf 2 Jul 2002 16:54:25 -0000 1.3 @@ -63,7 +63,7 @@ <!-- Paths configuration --> <userspath>/users</userspath> - <guestpath>/users/anonymous</guestpath> + <guestpath>guest</guestpath> <filespath>/files</filespath> <parameter name="dav">true</parameter> <parameter name="standalone">true</parameter> @@ -96,7 +96,7 @@ <!-- /users --> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users"> <permission action="/actions" subject="~"/> - <permission action="/actions" subject="/users/anonymous" inheritable="true" negative="true"/> + <permission action="/actions" subject="/users/guest" inheritable="true" negative="true"/> <permission action="/actions/read" subject="/users" inheritable="false"/> <!-- Permission group example --> @@ -124,7 +124,7 @@ </objectnode> <!-- /users/guest represents an authenticated or unauthenticated guest user --> - <objectnode classname="slideroles.basic.GuestRoleImpl" uri="/users/anonymous"> + <objectnode classname="slideroles.basic.GuestRoleImpl" uri="/users/guest"> <revision> <property name="password"/> </revision> @@ -138,9 +138,9 @@ </objectnode> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/files"> - <permission action="/actions" subject="/users/anonymous"/> + <permission action="/actions" subject="/users/guest"/> <permission action="/actions/manage" subject="/users/john"/> - <permission action="/actions/write" subject="/users/groupA"/> + <permission action="/actions/write" subject="+/users/groupA"/> <permission action="/actions/read" subject="nobody"/> </objectnode> </objectnode> 1.1 xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4properties.xsl Index: rdf2html4properties.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:source="http://xml.apache.org/cocoon/source/1.0" xmlns:dav="DAV:"> <xsl:output indent="yes"/> <xsl:template match="/"> <html> <head> <title>Apache Cocoon @version@</title> <link rel="SHORTCUT ICON" href="favicon.ico"/> </head> <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75"> <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> <tr> <td width="*"><font face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to present...</font></td> <td width="40%" align="center"><img border="0" src="/cocoon/samples/images/cocoon.gif"/></td> <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version @version@</b></font></td> </tr> <tr> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> <tr> <td width="90%" align="right" bgcolor="#0086b2"><i>orthogonal views: </i></td> <td nowrap="nowrap" bgcolor="#ffffff"><a href="?cocoon-view=content"><i>content</i></a></td> <td nowrap="nowrap" bgcolor="#ffffff"><a href="?cocoon-view=pretty-content"><i>properties</i></a></td> <td nowrap="nowrap" bgcolor="#ffffff"><a href="?cocoon-view=links"><i>permissions</i></a></td> <td nowrap="nowrap" bgcolor="#ffffff"><a href="?cocoon-view=links"><i>locks</i></a></td> </tr> </table> </tr> </table> <xsl:apply-templates select="rdf:RDF/rdf:Description[1]"/> <p align="center"> <font size="-1"> Copyright © @year@ <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/> All rights reserved. </font> </p> </body> </html> </xsl:template> <xsl:template match="rdf:Description"> <table width="100%"> <tr> <td width="200" valign="top"> <table border="0" bgcolor="#000000" cellpadding="0" cellspacing="0" width="97%"> <tbody> <tr> <td> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> <tr> <td bgcolor="#0086b2" width="100%" align="left"> <font size="+1" face="arial,helvetica,sanserif" color="#ffffff"><xsl:value-of select="@rdf:about"/></font> </td> </tr> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2" width="100%" align="center"> <xsl:if test="source:parent"> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <a href="/cocoon/samples/slide/browse/{substring-after(source:parent,'://')}">Back</a> </td> </tr> </xsl:if> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <br/> </td> </tr> <xsl:for-each select="source:children/rdf:Seq/rdf:li"> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <font size="+0" face="arial,helvetica,sanserif" color="#000000"> <a href="/cocoon/samples/slide/browse/{substring-after(@rdf:resource,'://')}" ><xsl:value-of select="@rdf:resource"/></a> </font> </td> </tr> </xsl:for-each> </table> </td> </tr> </table> </td> </tr> </tbody> </table> <br/> </td> <td valign="top"> <table border="0" bgcolor="#000000" cellpadding="0" cellspacing="0" width="97%"> <tbody> <tr> <td> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> <tr> <td bgcolor="#0086b2" width="100%" align="left"> <font size="+1" face="arial,helvetica,sanserif" color="#ffffff">Properties</font> </td> </tr> <tr> <td width="100%" bgcolor="#ffffff" align="left"> <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>Namespace</b></td> <td align="left"><b>Name</b></td> <td align="left"><b>Value</b></td> <td align="right"></td> </tr> <xsl:for-each select="*[local-name()!='children' and local-name()!='permissions' and local-name()!='locks' and local-name()!='parent']"> <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"> <form action="" method="get"> <input type="hidden" name="uri" value="{../@rdf:about}"/> <input type="hidden" name="namespace" value="{namespace-uri()}"/> <input type="hidden" name="name" value="{local-name()}"/> <input type="submit" name="cocoon-action-deleteproperty" value="Delete"/> </form> </td> </tr> </xsl:for-each> <tr> <form action="" method="get"> <input type="hidden" name="uri" value="{@rdf:about}"/> <td align="left"> <input name="namespace" type="text" size="25" 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="cocoon-action-addproperty" value="Add/Modify"/> </td> </form> </tr> </font> </table> </td> </tr> </table> </td> </tr> </tbody> </table> <br/> </td> </tr> </table> </xsl:template> </xsl:stylesheet>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]