Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 12035 invoked by uid 500); 8 Jul 2002 08:15:14 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 12025 invoked by uid 500); 8 Jul 2002 08:15:14 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 8 Jul 2002 08:15:13 -0000 Message-ID: <20020708081513.99665.qmail@icarus.apache.org> From: stephan@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/webapp/samples sitemap.xmap X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N stephan 2002/07/08 01:15:13 Modified: src/scratchpad/src/org/apache/cocoon/components/repository PrincipalProvider.java src/scratchpad/src/org/apache/cocoon/generation PrincipalListGenerator.java src/scratchpad/webapp/samples/slide login.html principal2html4users.xsl rdf2html4content.xsl sitemap.xmap src/webapp/samples sitemap.xmap Added: src/scratchpad/src/org/apache/cocoon/acting PrincipalMultiAction.java SourceMultiAction.java src/scratchpad/src/org/apache/cocoon/components/source/helpers PrincipalSourcePermission.java Removed: src/scratchpad/src/org/apache/cocoon/components/source/helpers UserSourcePermission.java Log: Created a MultiAction for sources and the PrincipalProvider. UserSourcePermission renamed to PrincipalSourcePermission. First stages to use the authentification framework with the PrincipalProvider. Revision Changes Path 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/PrincipalMultiAction.java Index: PrincipalMultiAction.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, 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 apache@apache.org. 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 (INCLU- DING, 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 and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.acting; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentSelector; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.acting.AbstractAction; import org.apache.cocoon.components.repository.Principal; import org.apache.cocoon.components.repository.PrincipalGroup; import org.apache.cocoon.components.repository.PrincipalProvider; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.SourceResolver; import java.util.Map; /** * Multiple actions for to add, to removing and to modify principals or principal groups. * * @author Stephan Michels * @version CVS $Id: PrincipalMultiAction.java,v 1.1 2002/07/08 08:15:12 stephan Exp $ */ public class PrincipalMultiAction extends AbstractMethodAction implements ThreadSafe { public final static String CALLER_PRINCIPAL_NAME = "cocoon-caller-principal-name"; public final static String CALLER_PRINCIPAL_PASSWORD = "cocooon-caller-principal-password"; public final static String PRINCIPAL_PROVIDER = "cocoon-principal-provider"; public final static String PRINCIPAL_NAME = "cocoon-principal-name"; public final static String PRINCIPAL_ROLE = "cocoon-principal-role"; public final static String PRINCIPAL_PASSWORD = "cocoon-principal-password"; public final static String PRINCIPAL_GROUP_NAME = "cocoon-principal-group-name"; public Map doAddPrincipal(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add principal called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_name = parameters.getParameter(PRINCIPAL_NAME, request.getParameter(PRINCIPAL_NAME)); String principal_role = parameters.getParameter(PRINCIPAL_ROLE, request.getParameter(PRINCIPAL_ROLE)); String principal_password = parameters.getParameter(PRINCIPAL_PASSWORD, request.getParameter(PRINCIPAL_PASSWORD)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); Principal principal = new Principal(principal_name, principal_role, principal_password); principalprovider.addPrincipal(caller, principal); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } public Map doRemovePrincipal(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("remove principal called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_name = parameters.getParameter(PRINCIPAL_NAME, request.getParameter(PRINCIPAL_NAME)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); Principal principal = new Principal(principal_name); principalprovider.removePrincipal(caller, principal); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } public Map doAddPrincipalGroup(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add principal group called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME, request.getParameter(PRINCIPAL_GROUP_NAME)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name); principalprovider.addPrincipalGroup(caller, principalgroup); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } public Map doRemovePrincipalGroup(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("remove principal group called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME, request.getParameter(PRINCIPAL_GROUP_NAME)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name); principalprovider.removePrincipalGroup(caller, principalgroup); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } public Map doAddPrincipalGroupMember(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add principal group member called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME, request.getParameter(PRINCIPAL_GROUP_NAME)); String principal_name = parameters.getParameter(PRINCIPAL_NAME, request.getParameter(PRINCIPAL_NAME)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name); Principal principal = new Principal(principal_name); principalprovider.addMember(caller, principalgroup, principal); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } public Map doRemovePrincipalGroupMember(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add principal group member called"); Request request = ObjectModelHelper.getRequest(objectModel); String principal_provider = parameters.getParameter(PRINCIPAL_PROVIDER, request.getParameter(PRINCIPAL_PROVIDER)); String caller_principal_name = parameters.getParameter(CALLER_PRINCIPAL_NAME, request.getParameter(CALLER_PRINCIPAL_NAME)); String caller_principal_password = parameters.getParameter(CALLER_PRINCIPAL_PASSWORD, request.getParameter(CALLER_PRINCIPAL_PASSWORD)); String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME, request.getParameter(PRINCIPAL_GROUP_NAME)); String principal_name = parameters.getParameter(PRINCIPAL_NAME, request.getParameter(PRINCIPAL_NAME)); ComponentSelector principalproviders = null; PrincipalProvider principalprovider = null; try { principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector"); principalprovider = (PrincipalProvider)principalproviders.select(principal_provider); Principal caller = new Principal(caller_principal_name, caller_principal_password); PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name); Principal principal = new Principal(principal_name); principalprovider.removeMember(caller, principalgroup, principal); } catch (ComponentException ce) { getLogger().error("Could not lookup for component.", ce); throw new ProcessingException("Could not lookup for component.", ce); } finally { if (principalprovider!=null) principalproviders.release(principalprovider); principalprovider = null; if (principalproviders!=null) this.manager.release(principalproviders); principalproviders = null; } return EMPTY_MAP; } } 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceMultiAction.java Index: SourceMultiAction.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, 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 apache@apache.org. 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 (INCLU- DING, 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 and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.acting; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; 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.InspectableSource; import org.apache.cocoon.components.source.RestrictableSource; import org.apache.cocoon.components.source.WriteableSource; import org.apache.cocoon.components.source.helpers.GroupSourcePermission; import org.apache.cocoon.components.source.helpers.PrincipalSourcePermission; import org.apache.cocoon.components.source.helpers.SourceCredential; import org.apache.cocoon.components.source.helpers.SourcePermission; import org.apache.cocoon.components.source.helpers.SourceProperty; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.SourceResolver; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Map; /** * Multiple actions for upload files, change properties and permissions. * * @author Stephan Michels * @version CVS $Id: SourceMultiAction.java,v 1.1 2002/07/08 08:15:12 stephan Exp $ */ public class SourceMultiAction extends AbstractMethodAction implements Contextualizable, ThreadSafe { public final static String SOURCE_URI = "cocoon-source-uri"; public final static String SOURCE_PROPERTY_NAMESPACE = "cocooon-source-property-namespace"; public final static String SOURCE_PROPERTY_NAME = "cocoon-source-property-name"; public final static String SOURCE_PROPERTY_VALUE = "cocoon-source-property-value"; public final static String SOURCE_PERMISSION_PRINCIPAL = "cocoon-source-permission-principal"; public final static String SOURCE_PERMISSION_PRIVILEGE = "cocoon-source-permission-privilege"; public final static String SOURCE_PERMISSION_INHERITABLE = "cocoon-source-permission-inheritable"; public final static String SOURCE_PERMISSION_NEGATIVE = "cocoon-source-permission-negative"; public final static String PRINCIPAL = "cocoon-principal"; public final static String PASSWORD = "cocoon-password"; public final static String UPLOAD_FILE = "cocoon-upload-file"; File uploadDir = null; /** Contextualize this class */ public void contextualize(Context context) throws ContextException { uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } public Map doUploadSource(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("upload source called"); Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); //String filename = parameters.getParameter("filename", request.getParameter("filename")); String principal = parameters.getParameter(PRINCIPAL, request.getParameter(PRINCIPAL)); String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); if ((request.get(UPLOAD_FILE)!=null) && (request.get(UPLOAD_FILE) instanceof FilePartFile)) { File uploadFile = ((FilePartFile)request.get(UPLOAD_FILE)).getFile(); try { if ((uri==null) || (uri.length()==0)) return EMPTY_MAP; Source source = resolver.resolveURI(uri); if (source instanceof RestrictableSource) ((RestrictableSource)source).setSourceCredential(new SourceCredential(principal, password)); if (source instanceof WriteableSource) { WriteableSource writeablesource = (WriteableSource)source; OutputStream out = writeablesource.getOutputStream(); byte[] buffer = new byte[8192]; int length = -1; InputStream in = new FileInputStream(uploadFile); while ((length = in.read(buffer)) > -1) { out.write(buffer, 0, length); } in.close(); out.flush(); out.close(); } else throw new ProcessingException("Source isn't writeable"); } catch (SourceException se) { throw new ProcessingException("Exception occurs while storing the content", se); } catch (IOException ioe) { throw new ProcessingException("Exception occurs while storing the content", ioe); } } return EMPTY_MAP; } public Map doDeleteSource(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("delete source called"); Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); //String filename = parameters.getParameter("filename", request.getParameter("filename")); try { Source source = resolver.resolveURI(uri); if (source instanceof WriteableSource) { WriteableSource writeablesource = (WriteableSource)source; //FIXME : evaluate a interface for a delete method //writeablesource.delete(); } else throw new ProcessingException("Source isn't writeable"); } catch (SourceException se) { throw new ProcessingException("Exception occurs while modifying the source", se); } return EMPTY_MAP; } public Map doAddProperty(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add property called"); Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); String namespace = parameters.getParameter(SOURCE_PROPERTY_NAMESPACE, request.getParameter(SOURCE_PROPERTY_NAMESPACE)); String name = parameters.getParameter(SOURCE_PROPERTY_NAME, request.getParameter(SOURCE_PROPERTY_NAME)); String value = parameters.getParameter(SOURCE_PROPERTY_VALUE, request.getParameter(SOURCE_PROPERTY_VALUE)); try { Source source = resolver.resolveURI(uri); if (source instanceof InspectableSource) { InspectableSource inspectablesource = (InspectableSource)source; SourceProperty property = new SourceProperty(namespace, name, value); inspectablesource.setSourceProperty(property); } else throw new ProcessingException("Source isn't inspectable"); } catch (SourceException se) { throw new ProcessingException("Exception occurs while modifying the source", se); } return EMPTY_MAP; } public Map doDeleteProperty(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("delete property called"); Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); String namespace = parameters.getParameter(SOURCE_PROPERTY_NAMESPACE, request.getParameter(SOURCE_PROPERTY_NAMESPACE)); String name = parameters.getParameter(SOURCE_PROPERTY_NAME, request.getParameter(SOURCE_PROPERTY_NAME)); try { Source source = resolver.resolveURI(uri); if (source instanceof InspectableSource) { InspectableSource inspectablesource = (InspectableSource)source; inspectablesource.removeSourceProperty(namespace, name); } else throw new ProcessingException("Source isn't inspectable"); } catch (SourceException se) { throw new ProcessingException("Exception occurs while modifying the source", se); } return EMPTY_MAP; } public Map doSetPrincipalPermission(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { getLogger().debug("add principal permission called"); Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); String principal = parameters.getParameter(SOURCE_PERMISSION_PRINCIPAL, request.getParameter(SOURCE_PERMISSION_PRINCIPAL)); String privilege = parameters.getParameter(SOURCE_PERMISSION_PRIVILEGE, request.getParameter(SOURCE_PERMISSION_PRIVILEGE)); boolean inheritable = Boolean.getBoolean(parameters.getParameter(SOURCE_PERMISSION_INHERITABLE, request.getParameter(SOURCE_PERMISSION_INHERITABLE))); boolean negative = Boolean.getBoolean(parameters.getParameter(SOURCE_PERMISSION_NEGATIVE, request.getParameter(SOURCE_PERMISSION_NEGATIVE))); try { Source source = resolver.resolveURI(uri); if (source instanceof RestrictableSource) { RestrictableSource restrictablesource = (RestrictableSource)source; SourcePermission permission = new PrincipalSourcePermission(principal, privilege, inheritable, negative); restrictablesource.setSourcePermission(permission); } else throw new ProcessingException("Source isn't restrictable"); } catch (SourceException se) { throw new ProcessingException("Exception occurs while modifying the source", se); } return EMPTY_MAP; } } 1.2 +19 -1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/PrincipalProvider.java Index: PrincipalProvider.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/PrincipalProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PrincipalProvider.java 4 Jul 2002 17:32:41 -0000 1.1 +++ PrincipalProvider.java 8 Jul 2002 08:15:12 -0000 1.2 @@ -92,6 +92,15 @@ throws ProcessingException; /** + * Remove a given principal. + * + * @param caller The principal, which should do the operation. + * @param principal The Principal, which should be removed. + */ + public void removePrincipal(Principal caller, Principal principal) + throws ProcessingException; + + /** * Return all groups. * * @param caller The principal, which should do the operation. @@ -107,6 +116,15 @@ * @param group The group, which shoud be add/modified. */ public void addPrincipalGroup(Principal caller, PrincipalGroup group) + throws ProcessingException; + + /** + * Remove a given group. + * + * @param caller The principal, which should do the operation. + * @param group The group, which shoud be removed. + */ + public void removePrincipalGroup(Principal caller, PrincipalGroup group) throws ProcessingException; /** 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/PrincipalSourcePermission.java Index: PrincipalSourcePermission.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 apache@apache.org. * * 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 * . */ package org.apache.cocoon.components.source.helpers; /** * This class represents a source permission for users * * @author Stephan Michels * @version $Id: PrincipalSourcePermission.java,v 1.1 2002/07/08 08:15:12 stephan Exp $ */ public class PrincipalSourcePermission 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 PrincipalSourcePermission(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 -2 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/PrincipalListGenerator.java Index: PrincipalListGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/PrincipalListGenerator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PrincipalListGenerator.java 5 Jul 2002 13:37:37 -0000 1.1 +++ PrincipalListGenerator.java 8 Jul 2002 08:15:13 -0000 1.2 @@ -70,7 +70,7 @@ import org.apache.cocoon.components.repository.PrincipalGroup; import org.apache.cocoon.components.repository.PrincipalProvider; import org.apache.cocoon.environment.SourceResolver; -import org.apache.cocoon.xml.EmbeddedXMLPipe; +//import org.apache.cocoon.xml.EmbeddedXMLPipe; //import org.xml.sax.Attributes; import org.xml.sax.SAXException; 1.2 +80 -12 xml-cocoon2/src/scratchpad/webapp/samples/slide/login.html Index: login.html =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/login.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- login.html 1 Jul 2002 15:09:21 -0000 1.1 +++ login.html 8 Jul 2002 08:15:13 -0000 1.2 @@ -1,12 +1,80 @@ - - - Login page - - -
- Username:
- Password:
- -
- - + + + + Apache Cocoon @version@ + + + + + + + + + + +
The Apache Software Foundation is proud to present...version @version@
+ + + +
+
+
+ + + + + + + +
+ + + + + + +
+ + + + + + + +
+ Login +
+ + + + + + + + + + + + + + + + + +
Username
Password
+
+ +
+ +
+
+ + +

+ + Copyright © @year@ The Apache Software Foundation.
+ All rights reserved. +
+

+ + 1.2 +5 -1 xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2html4users.xsl Index: principal2html4users.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2html4users.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- principal2html4users.xsl 5 Jul 2002 13:37:37 -0000 1.1 +++ principal2html4users.xsl 8 Jul 2002 08:15:13 -0000 1.2 @@ -91,6 +91,7 @@
+ @@ -106,6 +107,7 @@ + @@ -130,6 +132,7 @@ + @@ -150,6 +153,7 @@ + @@ -223,7 +227,7 @@ - + 1.4 +1 -1 xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl Index: rdf2html4content.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- rdf2html4content.xsl 5 Jul 2002 13:37:37 -0000 1.3 +++ rdf2html4content.xsl 8 Jul 2002 08:15:13 -0000 1.4 @@ -168,7 +168,7 @@ File: - + 1.5 +51 -25 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- sitemap.xmap 5 Jul 2002 13:37:37 -0000 1.4 +++ sitemap.xmap 8 Jul 2002 08:15:13 -0000 1.5 @@ -36,26 +36,31 @@ - + src="org.apache.cocoon.acting.SourceDeleteContentAction"/>--> + + + - + src="org.apache.cocoon.webapps.authentication.acting.AuthAction"/> + @@ -83,7 +88,7 @@ - + + + + + + + + + + + + - + @@ -123,8 +149,8 @@ - + @@ -166,7 +192,7 @@ - + @@ -177,7 +203,7 @@ - + @@ -188,7 +214,7 @@ - + @@ -199,7 +225,7 @@ - + @@ -216,7 +242,7 @@ - + @@ -228,11 +254,11 @@ - + + - + 1.11 +3 -1 xml-cocoon2/src/webapp/samples/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/sitemap.xmap,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- sitemap.xmap 4 Jul 2002 05:17:44 -0000 1.10 +++ sitemap.xmap 8 Jul 2002 08:15:13 -0000 1.11 @@ -972,7 +972,9 @@ - + + + ---------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: cocoon-cvs-help@xml.apache.org