head	1.17;
access;
symbols
	TIGRIS_1_1_0RC2:1.5.6.1
	TIGRIS_1_1_0RC1:1.5.6.1
	TIGRIS_1_1:1.5.6.1.0.2
	TIGRIS_1_0_8:1.5.6.1
	TIGRIS_1_0_8RC3:1.5.6.1
	TIGRIS_1_0_8RC2:1.5.6.1
	TIGRIS_1_0_8RC1:1.5.6.1
	TIGRIS_1_0_7:1.5.6.1
	TIGRIS_1_0_7RC3:1.5.6.1
	TIGRIS_1_0_7RC2:1.5.6.1
	TIGRIS_1_0_7RC1:1.5.6.1
	TIGRIS_1_0_6:1.5
	TIGRIS_1_0_6RC5:1.5
	TIGRIS_1_0_6RC4:1.5
	TIGRIS_1_0_6RC3:1.5
	TIGRIS_1_0_6RC2:1.5
	TIGRIS_1_0_6RC1:1.5
	TIGRIS_1_0_5:1.5
	TIGRIS_1_0_5RC6:1.5
	TIGRIS_1_0_5RC5:1.5
	TIGRIS_1_0_5RC4:1.5
	TIGRIS_1_0_5RC3:1.5
	TIGRIS_1_0_5RC2:1.5
	TIGRIS_1_0_5RC1:1.5
	TIGRIS_1_0_4:1.5
	TIGRIS_1_0_3:1.5
	TIGRIS_1_0_2:1.5
	TIGRIS_1_0_1:1.5
	TIGRIS_1_0:1.5.0.6
	TIGRIS_1_0_0:1.5
	TIGRIS_1_0_0_RC1:1.5.0.2
	dlr:1.1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1;
locks; strict;
comment	@# @;


1.17
date	2001.08.11.09.08.09;	author dlr;	state Exp;
branches;
next	1.16;

1.16
date	2001.08.03.00.37.00;	author ms;	state Exp;
branches;
next	1.15;

1.15
date	2001.07.18.10.05.16;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2001.07.06.00.19.26;	author ms;	state Exp;
branches;
next	1.13;

1.13
date	2001.06.20.02.10.27;	author ms;	state Exp;
branches;
next	1.12;

1.12
date	2001.05.23.01.50.22;	author dlr;	state Exp;
branches;
next	1.11;

1.11
date	2001.05.21.21.07.45;	author ms;	state Exp;
branches;
next	1.10;

1.10
date	2001.05.21.20.37.57;	author ms;	state Exp;
branches;
next	1.9;

1.9
date	2001.05.21.17.19.41;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2001.05.21.16.52.51;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2001.05.05.08.43.59;	author ms;	state Exp;
branches;
next	1.6;

1.6
date	2001.04.16.18.38.37;	author ms;	state Exp;
branches;
next	1.5;

1.5
date	2001.03.27.13.20.16;	author ms;	state Exp;
branches
	1.5.6.1;
next	1.4;

1.4
date	2001.03.10.07.52.57;	author edk;	state Exp;
branches;
next	1.3;

1.3
date	2001.03.07.01.53.28;	author lucas;	state Exp;
branches;
next	1.2;

1.2
date	2001.02.21.01.08.26;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.02.13.12.26.39;	author ms;	state Exp;
branches
	1.1.1.1
	1.1.2.1;
next	;

1.1.1.1
date	2001.02.21.00.35.22;	author dlr;	state Exp;
branches;
next	;

1.1.2.1
date	2001.02.13.13.03.59;	author ms;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.13.13.19.38;	author ms;	state Exp;
branches;
next	;

1.5.6.1
date	2001.06.14.10.29.58;	author edk;	state Exp;
branches;
next	;


desc
@@


1.17
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@package org.tigris.helm.tool.mail;

import org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;

import org.apache.velocity.context.Context;

import com.quiotix.util.*;
import com.quiotix.util.io.*;

import org.tigris.eyebrowse.core.ReadMsg;

import org.tigris.helm.security.RedirectException;

import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.tool.ContextAPI;

/**
 * HelmReadMsgServlet
 * A thin wrapper around org.tigris.eyebrowse.core.ReadMsg 
 * to allow eyebrowse to work in Helm
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbReadMsg.java,v 1.16 2001/08/03 00:37:00 ms Exp $
 */
public class EbReadMsg extends HelmServlet
{
    public String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        String listName = ContextAPI.getParameter(context, "listName");
        context.put("listName", listName);
        context.put("msgNo", ContextAPI.getParameter(context, "msgNo"));

        //verify that the list is in the same project as the current project.
        AccessControlList acl = null;
        try
        {
            if (listName == null)
            {
                throw new NestableException("No list name specified");
            }
            acl = getLoginUser(context).getACL();
            Project currentProject = getCurrentProject(context);
            MailingList ml = MailingListPeer.getInstanceByName(currentProject,
                                                               listName);
            if (!ml.isViewableBy(acl))
            {
                redirectToUnauthorized();
            }

            // eyebrowse the full list address while helm uses only
            // the name of the data before the '@@'
            // this is how we couple the two.
            context.put("listName", ml.getAddress(null));
            context = ReadMsg.core(context);
            context.put("listName", listName);

            context.put("description", ml.getDescription());
            Boolean msgAvailable = (Boolean)context.get("msgAvailable");

            // if message was removed and you're not an admin , deny access
            if (!msgAvailable.booleanValue()  && 
                !acl.hasPermission("Mailing List - Edit"))
            {
                throw new NestableException("Message not available");
            }
        } 
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            throw new NestableException("Error verifying access", e);
        }
        return templateName;
    }

}
@


1.16
log
@eyebrowse handles velocity now
@
text
@d4 1
a4 1
import org.apache.turbine.util.TurbineException;
d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.15 2001/07/18 10:05:16 dlr Exp $
d34 1
a34 1
        throws TurbineException, RedirectException
d47 1
a47 1
                throw new TurbineException("No list name specified");
d72 1
a72 1
                throw new TurbineException("Message not available");
d81 1
a81 1
            throw new TurbineException("Error verifying access", e);
@


1.15
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a10 1
import org.tigris.eyebrowse.core.ContextAdaptor;
d20 1
d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.14 2001/07/06 00:19:26 ms Exp $
d33 1
a33 1
    public String processRequest(Context ctx)
d36 2
a37 3
        String templateName = super.processRequest(ctx);
        ContextAdaptor context = new EbVelocityContext(ctx);
        String listName = context.getParameter("listName");
d39 2
d49 2
a50 2
            acl = getLoginUser(ctx).getACL();
            Project currentProject = getCurrentProject(ctx);
d67 1
@


1.14
log
@trying hard not to get too close to eyebrowse for fear of combustion
@
text
@d14 1
a14 1
import org.joist.security.RedirectException;
d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.13 2001/06/20 02:10:27 ms Exp $
@


1.13
log
@give the template what it wants
@
text
@d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.12 2001/05/23 01:50:22 dlr Exp $
d56 5
d62 2
@


1.12
log
@Ported Helm from WebMacro to Velocity.
@
text
@d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.11 2001/05/21 21:07:45 ms Exp $
d57 1
@


1.11
log
@description not used in these servlets.
@
text
@d3 2
a4 1
import java.sql.Connection;
d6 1
a6 2
import org.webmacro.servlet.WebContext;
import org.webmacro.servlet.HandlerException;
a10 1
import org.tigris.eyebrowse.EyebrowseWMContext;
d17 3
a19 1
import org.tigris.helm.om.MailingListPeer;import org.tigris.helm.om.Project;
a20 1
import org.tigris.helm.security.AccessControlList;
d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.10 2001/05/21 20:37:57 ms Exp $
d33 2
a34 2
    public String processRequest(Connection connection, WebContext ctx)
        throws HandlerException, RedirectException
d36 2
a37 2
        String templateName = super.processRequest(connection, ctx);
        ContextAdaptor context = new EyebrowseWMContext(ctx);
d46 1
a46 1
                throw new HandlerException("No listName specified");
d62 1
a62 1
                throw new HandlerException("Message not available");
d71 1
a71 4
            e.printStackTrace();
            throw new HandlerException(
                "exception verifying access via MailingList obj: " +
                e.getMessage());
@


1.10
log
@used description from helm
@
text
@d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.9 2001/05/21 17:19:41 dlr Exp $
a56 1
            context.put("description", ml.getDescription());
@


1.9
log
@HelmServlet methods take a specific type of context object, rather than the adaptor.
@
text
@d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.8 2001/05/21 16:52:51 dlr Exp $
d57 1
@


1.8
log
@Made use of new ContextAdaptor class which was introduced so that EB could play nicely with other types of contexts.
@
text
@d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.7 2001/05/05 08:43:59 ms Exp $
d48 2
a49 2
            acl = getLoginUser(context).getACL();
            Project currentProject = getCurrentProject(context);
@


1.7
log
@skip out if the list isnt passed
@
text
@d8 7
a21 5
import com.quiotix.util.*;
import com.quiotix.util.io.*;

import org.tigris.eyebrowse.core.ReadMsg;

d29 1
a29 1
 * @@version $Id: EbReadMsg.java,v 1.6 2001/04/16 18:38:37 ms Exp $
d33 1
a33 1
    public String processRequest(Connection connection, WebContext context) 
d36 3
a38 2
        String templateName = super.processRequest(connection, context);
        String listName = context.getForm("listName");
@


1.6
log
@
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d27 1
a27 1
 * @@version $Id: EbReadMsg.java,v 1.5 2001/03/27 13:20:16 ms Exp $
d41 4
@


1.5
log
@Changed in eyebrowse the ability to lookup lists by both listId and by listName.
Greatly cleans up the coupling between the archives and helm IMO.

I also removed the useless projecID's in the templates.

This requires an update in eyebrowse also to compile.

note: SearchList is now a bit broken, will be fixed tomorow..

QA note. i tested this with two different lists, browsed by date author etc, it
showed no problems that dont already exist (date browsing).
@
text
@d13 1
d27 1
a27 1
 * @@version $Id: EbReadMsg.java,v 1.4 2001/03/10 07:52:57 edk Exp $
a36 1
    
d38 1
d41 1
d45 1
a45 1
            if (!ml.isViewableBy(getLoginUser(context).getACL()))
d49 8
a68 1
        context = ReadMsg.core(context);
@


1.5.6.1
log
@use helm's description of the mailing list
@
text
@d26 1
a26 1
 * @@version $Id: EbReadMsg.java,v 1.5 2001/03/27 13:20:16 ms Exp $
a34 1
        String description = null;
a46 2

            description = ml.getDescription();
a59 1
        context.put("description", description);
@


1.4
log
@check isViewableBy, which helps us do a better job enforcing permissions
as well as the isPrivate flag
@
text
@d26 1
a26 1
 * @@version $Id: EbReadMsg.java,v 1.3 2001/03/07 01:53:28 lucas Exp $
d30 6
a35 6
  public String processRequest(Connection connection, WebContext context) 
    throws HandlerException, RedirectException
  {
    String templateName = super.processRequest(connection, context);
    String listId = context.getForm("listId");
    context.put("listId", listId);
d37 24
a60 13
    try { //verify that the list is in the same project as the current project.
      Project currentProject = getCurrentProject(context);
      MailingList ml = MailingListPeer.getInstance(currentProject, listId);
      if (!ml.isViewableBy(getLoginUser(context).getACL())) {
        redirectToUnauthorized();
      }
    } catch (RedirectException e) {
      throw e;
    } catch (Exception e) {
      e.printStackTrace();
      throw new HandlerException(
          "exception verifying access via MailingList obj: " +
          e.getMessage());
d62 1
a62 3
    context = ReadMsg.core(context);
    return templateName;
  }
a63 1

@


1.3
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d26 1
a26 1
 * @@version $Id: EbReadMsg.java,v 1.2 2001/02/21 01:08:26 dlr Exp $
d40 3
@


1.2
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d11 1
a11 2
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
d26 1
a26 1
 * @@version $Id: EbReadMsg.java,v 1.1.2.2 2001/02/13 13:19:38 ms Exp $
@


1.1
log
@Adding these to helm for logical organization and for build depdancy
flow. To install these servlets eyebrowse must be built and installed
with the helm top-level make target's "eyebrowse" and
"eyebrowse-install". If succesful these servlets will be installed also.
@
text
@a0 32
/*
 * Copyright (c) 2000, Quiotix Corporation
 *        All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 *      Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 *      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.
 * 
 *      Neither name of Quiotix Corporation nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS 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 COPYRIGHT
 * HOLDER OR 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.
 */

d3 1
a3 2
import org.tigris.helm.tool.mail.MailingList;
import org.tigris.helm.project.Project;
a4 4
import org.tigris.helm.security.HelmServlet;
import org.joist.security.RedirectException;

import java.sql.Connection;
d8 6
a13 1
import org.tigris.eyebrowse.core.ReadMsg;
d18 2
d24 4
a28 1

d40 1
a40 2
      MailingList ml = new MailingList(connection,
          getDataManager(context), listId, currentProject);
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d1 32
d35 6
a41 1

d45 1
a45 6
import org.joist.security.RedirectException;

import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.HelmServlet;
a49 2
import org.tigris.eyebrowse.core.ReadMsg;

a53 4
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbReadMsg.java,v 1.1.2.2 2001/02/13 13:19:38 ms Exp $
d55 1
d67 2
a68 1
      MailingList ml = MailingListPeer.getInstance(currentProject, listId);
@


1.1.2.1
log
@Ported changes to HEAD to branch. Moved servlets into logical container
of org.tigris.helm.tool.mail and changed build system and jserv config
to match changes.
@
text
@@


1.1.2.2
log
@Merged Dlr's eyebrowse servlets that follow the peer model into helm.
@
text
@d1 32
d35 6
a41 1

d45 1
a45 6
import org.joist.security.RedirectException;

import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.HelmServlet;
a49 2
import org.tigris.eyebrowse.core.ReadMsg;

a53 4
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbReadMsg.java,v 1.5.6.1 2001/02/09 20:47:46 dlr Exp $
d55 1
d67 2
a68 1
      MailingList ml = MailingListPeer.getInstance(currentProject, listId);
@


