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


1.12
date	2001.08.28.17.45.17;	author leonardr;	state Exp;
branches;
next	1.11;

1.11
date	2001.08.28.17.13.33;	author leonardr;	state Exp;
branches;
next	1.10;

1.10
date	2001.08.11.09.08.07;	author dlr;	state Exp;
branches;
next	1.9;

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

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

1.7
date	2001.07.17.20.10.49;	author leonardr;	state Exp;
branches;
next	1.6;

1.6
date	2001.06.13.16.41.11;	author leonardr;	state Exp;
branches;
next	1.5;

1.5
date	2001.05.23.01.50.15;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2001.05.01.21.47.22;	author leonardr;	state Exp;
branches;
next	1.3;

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

1.2
date	2001.02.21.03.02.29;	author edk;	state Exp;
branches;
next	1.1;

1.1
date	2001.02.13.02.22.38;	author elicia;	state dead;
branches
	1.1.1.1
	1.1.2.1;
next	;

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

1.1.2.1
date	2001.02.13.02.22.38;	author elicia;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.13.19.55.03;	author leonardr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.15.20.50.42;	author leonardr;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2001.02.16.03.01.34;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.12
log
@More methods migrated to ContextAPI.
@
text
@/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  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 acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * 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 COLLABNET 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 CollabNet.
 */

package org.tigris.helm.project;

import java.util.*;
import java.sql.Connection;

import org.apache.velocity.context.Context;

import org.tigris.helm.security.RedirectException;
import org.tigris.helm.tool.Emailer;

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

import org.tigris.helm.security.*;

import org.tigris.helm.tool.paginate.*;

import org.tigris.helm.om.*;
import org.tigris.helm.tool.ContextAPI;

/**
 * Display a summary of users who belong to this project.
 */
public class ProjectMemberList extends org.tigris.helm.security.HelmServlet
{
    static private boolean DEBUG = true;
    private static final String USERS_PER_PAGE = "nbrUsersPerPage";

    private static final String REVOKE_ROLES_ACTION="Revoke Checked Roles";

    private static final String EDIT_ROLES_ACTION="Edit Roles";

    private static final String APPROVE_FIELD_PREFIX="Approve";
    private static final String DISAPPROVE_FIELD_PREFIX="Disapprove";

    private static final String DISAPPROVAL_REASON_FIELD ="disapprovalReason";

    /**
     * Revoke granted roles, or approve or disapprove requested roles.
     */
    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        Project currentProject = getCurrentProject(context);
        
        Enumeration paramNames = ContextAPI.getRequest(context)
            .getParameterNames();
        String paramName;

        String action = getAction(context);

        try
        {        
            AccessControlList acl = getLoginUser(context).getACL();
            if (action.equals (REVOKE_ROLES_ACTION))
            {
                while (paramNames.hasMoreElements())
                {
                    paramName = (String)paramNames.nextElement ();
                    if (paramName.startsWith("Revoke"))
                    {
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());
                        user.revokeRole(acl, role, currentProject);
                    }
                }                

            } 
            else if (action.equals(EDIT_ROLES_ACTION)) 
            {
                String disapprovalReason = ContextAPI.processField
                    (context, DISAPPROVAL_REASON_FIELD, (String)null);
                while (paramNames.hasMoreElements())
                {
                    paramName = (String) paramNames.nextElement ();
                    if (paramName.startsWith ("Pending"))
                    {
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());

                        String value = ContextAPI.getParameter
                            (context, paramName);
                        if (value.equals (APPROVE_FIELD_PREFIX))
                        {
                            user.approveRole(acl, role, currentProject);
                        } 
                        else if (value.equals (DISAPPROVE_FIELD_PREFIX)) 
                        {
                            user.disapproveRole(acl, role, currentProject, 
                                                disapprovalReason);
                        }
                    }
                }
            }
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.error("Exception thrown in ProjectMembers", e);
            throw new NestableException(e);
        }
        
        return templateName;
    }
    
} /* end class ProjectMembers */
@


1.11
log
@Completed migration of more methods to ContextAPI.
@
text
@d133 2
a134 1
                        String value = getParameter(context, paramName);
@


1.10
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d94 2
a95 1
        Enumeration paramNames = getRequest(context).getParameterNames();
@


1.9
log
@Removed Joist references.
@
text
@d58 2
a59 2
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.TurbineException;
d89 1
a89 1
        throws TurbineException, RedirectException
d153 1
a153 1
            throw new TurbineException(e);
@


1.8
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d55 1
a55 1
import org.joist.mail.Emailer;
@


1.7
log
@Ported servlets to new error-handling mechanism.
@
text
@d54 1
a54 1
import org.joist.security.RedirectException;
@


1.6
log
@Added reason for denying role requests and disapproving projects.
@
text
@d66 2
a67 1
import org.tigris.helm.om.*;
d120 1
a120 1
                String disapprovalReason = processField
a152 1
            appendToError(context, e.getMessage());
@


1.5
log
@Ported Helm from WebMacro to Velocity.
@
text
@d82 2
d116 5
a120 2
            } else if (action.equals(EDIT_ROLES_ACTION)) {

d135 5
a139 2
                        } else if (value.equals (DISAPPROVE_FIELD_PREFIX)) {
                            user.disapproveRole(acl, role, currentProject);
d144 3
a146 1
        } catch (RedirectException e) {
d148 3
a150 1
        } catch (Exception e) {
@


1.4
log
@Big architecture and schema change: booleans in the HELM_ROLE table have been replaced by entries in the HELM_ROLE_ATTRIBUTE_VALUE table. Also, a new attribute has been added which controls which roles a user gets upon creation of a project.
@
text
@d52 1
a52 1
import org.webmacro.servlet.*;
d58 2
d85 2
a86 2
    protected String processRequest (Connection connection, WebContext context)
        throws HandlerException, RedirectException
d88 1
a88 1
        String templateName = super.processRequest(connection, context);
d91 1
a91 1
        Enumeration paramNames = context.getRequest().getParameterNames();
d126 1
a126 1
                        String value = context.getForm(paramName);
d141 1
a141 1
            throw new HandlerException(e.getMessage());
@


1.3
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d134 2
@


1.2
log
@adding files from the branch to the head
@
text
@d64 1
a64 3
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;

@


1.1
log
@file ProjectMemberList.java was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@d1 145
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@a0 145
/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  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 acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * 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 COLLABNET 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 CollabNet.
 */

package org.tigris.helm.project;

import java.util.*;
import java.sql.Connection;

import org.webmacro.servlet.*;

import org.joist.security.RedirectException;
import org.joist.mail.Emailer;

import org.apache.turbine.util.Log;

import org.tigris.helm.security.*;

import org.tigris.helm.tool.paginate.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;

/**
 * Display a summary of users who belong to this project.
 */
public class ProjectMemberList extends org.tigris.helm.security.HelmServlet
{
    static private boolean DEBUG = true;
    private static final String USERS_PER_PAGE = "nbrUsersPerPage";

    private static final String REVOKE_ROLES_ACTION="Revoke Checked Roles";

    private static final String EDIT_ROLES_ACTION="Edit Roles";

    private static final String APPROVE_FIELD_PREFIX="Approve";
    private static final String DISAPPROVE_FIELD_PREFIX="Disapprove";

    /**
     * Revoke granted roles, or approve or disapprove requested roles.
     */
    protected String processRequest (Connection connection, WebContext context)
        throws HandlerException, RedirectException
    {
        String templateName = super.processRequest(connection, context);
        Project currentProject = getCurrentProject(context);
        
        Enumeration paramNames = context.getRequest().getParameterNames();
        String paramName;

        String action = getAction(context);

        try
        {        
            AccessControlList acl = getLoginUser(context).getACL();
            if (action.equals (REVOKE_ROLES_ACTION))
            {
                while (paramNames.hasMoreElements())
                {
                    paramName = (String)paramNames.nextElement ();
                    if (paramName.startsWith("Revoke"))
                    {
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());
                        user.revokeRole(acl, role, currentProject);
                    }
                }                

            } else if (action.equals(EDIT_ROLES_ACTION)) {

                while (paramNames.hasMoreElements())
                {
                    paramName = (String) paramNames.nextElement ();
                    if (paramName.startsWith ("Pending"))
                    {
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());

                        String value = context.getForm(paramName);
                        if (value.equals (APPROVE_FIELD_PREFIX))
                        {
                            user.approveRole(acl, role, currentProject);
                        } else if (value.equals (DISAPPROVE_FIELD_PREFIX)) {
                            user.disapproveRole(acl, role, currentProject);
                        }
                    }
                }
            }
        } catch (Exception e) {
            Log.error("Exception thrown in ProjectMembers", e);
            appendToError(context, e.getMessage());
            throw new HandlerException(e.getMessage());
        }
        
        return templateName;
    }
    
} /* end class ProjectMembers */
@


1.1.2.1
log
@ported to turbine. changed name from ProjectMembers
@
text
@a0 184
/* ================================================================
 * Copyright (c) 2000 CollabNet.  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 acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * 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 COLLABNET 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 CollabNet.
 */

package org.tigris.helm.project;

import java.util.Enumeration;
import java.util.Vector;
import java.util.List;
import java.util.StringTokenizer;
import java.sql.*;
import javax.servlet.http.*;

import org.apache.turbine.util.Log;
import org.webmacro.servlet.*;

import com.workingdogs.village.*;

import org.tigris.helm.security.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;

import org.joist.security.RedirectException;
import org.joist.mail.Emailer;

/**
 * Display a summary of users who belong to this project.
 */
public class ProjectMemberList extends HelmServlet
{
    static private boolean debug = true;
    private static final String USERS_PER_PAGE = "nbrUsersPerPage";
    
    protected String processRequest (Connection conn, WebContext ctx)
        throws HandlerException, RedirectException
    {
        String templateName = super.processRequest (conn, ctx);
        Project currentProject = getCurrentProject(ctx);
        
        Enumeration paramNames = ctx.getRequest().getParameterNames ();
        String paramName;
        Vector newSet = new Vector (50);

        String action = getAction(ctx);
        if (debug) Log.debug("action = " + action);

        try
        {        
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = getLoginUser(ctx).getACL();

            if (action.equals ("Revoke Checked Roles"))
            {
                while (paramNames.hasMoreElements ())
                {
                    paramName = (String) paramNames.nextElement ();
                    if (paramName.startsWith ("Revoke"))
                        newSet.addElement (paramName);
                }
                if (debug) Log.debug ("checked: " + newSet.toString ());
                
                for (int i = 0; i < newSet.size (); i++)
                {
                    String element = (String)newSet.elementAt(i);
                    StringTokenizer tok = new StringTokenizer (element);
                    tok.nextToken();
                    User user = (User)UserPeer.getInstance(tok.nextToken());
                    Role role = (Role)RolePeer.getInstance(tok.nextToken());
                    user.revokeRole(acl, role, currentProject);
                }
            
            } else if (action.equals ("Edit Roles")) {
            
                Vector values = new Vector ();
            
                while (paramNames.hasMoreElements ())
                {
                    paramName = (String) paramNames.nextElement ();
                    if (paramName.startsWith ("Pending"))
                    {
                        newSet.addElement (paramName);
                        values.addElement (ctx.getForm (paramName));
                    }
                }

                if (debug) Log.debug ("checked: " + newSet.toString ());
            
                Emailer emailer = new Emailer();
            
                for (int i = 0; i < newSet.size (); i++)
                {
                
                    String element = (String) newSet.elementAt (i);
                    StringTokenizer tok = new StringTokenizer (element);
                    tok.nextToken();
                    User user = (User)UserPeer.getInstance(tok.nextToken());
                    Role role = (Role)RolePeer.getInstance(tok.nextToken());
                    String value = (String) values.elementAt (i);                
                
                    if (debug)
                        Log.debug (value + " role " + role.getName() 
                                  + " for  user " + user.getRealName());
                
                    String subject;
                    String message;
                    StringBuffer messageBuf =
                        new StringBuffer ("You requested the role of ");
                    messageBuf.append (role.getName()).append (" on project '").
                        append (currentProject.getName()).append ("'. ");

                    if (value.equals ("Approve"))
                    {
                        user.grantRole(acl, role, currentProject);
                        subject = "Requested role has been granted";
                        messageBuf.append 
                            ("Congratulations! The role has been granted.");
                        message = messageBuf.toString();
                        emailer.sendEmail(user.getEmail(), subject, message);

                    } else if (value.equals ("Disapprove")) {
                        user.revokeRole(acl, role, currentProject);
                        subject = "Requested role has not been granted";
                        messageBuf.append
                            ("We regret to inform you that the role has not been granted.");
                        message = messageBuf.toString();
                        emailer.sendEmail(user.getEmail(), subject, message);
                    }
                }
            }

        } catch (Exception e) {
            Log.error (e);
            String message = "ProjectMembers: " + e.getMessage ();
            if (debug) Log.debug (message);
            ctx.put ("message", message);
        }
        
        return templateName;
    }
    
} /* end class ProjectMembers */
@


1.1.2.2
log
@Ported ProjectMemberList
@
text
@d49 6
a54 2
import java.util.*;
import java.sql.Connection;
d56 1
d59 1
a59 4
import org.joist.security.RedirectException;
import org.joist.mail.Emailer;

import org.apache.turbine.util.Log;
a62 2
import org.tigris.helm.tool.paginate.*;

d66 3
d72 1
a72 1
public class ProjectMemberList extends org.tigris.helm.security.HelmServlet
d74 1
a74 1
    static private boolean DEBUG = true;
d76 2
a77 12

    private static final String REVOKE_ROLES_ACTION="Revoke Checked Roles";

    private static final String EDIT_ROLES_ACTION="Edit Roles";

    private static final String APPROVE_FIELD_PREFIX="Approve";
    private static final String DISAPPROVE_FIELD_PREFIX="Disapprove";

    /**
     * Revoke granted roles, or approve or disapprove requested roles.
     */
    protected String processRequest (Connection connection, WebContext context)
d80 2
a81 2
        String templateName = super.processRequest(connection, context);
        Project currentProject = getCurrentProject(context);
d83 1
a83 1
        Enumeration paramNames = context.getRequest().getParameterNames();
d85 1
d87 2
a88 1
        String action = getAction(context);
d92 4
a95 2
            AccessControlList acl = getLoginUser(context).getACL();
            if (action.equals (REVOKE_ROLES_ACTION))
d97 23
a119 1
                while (paramNames.hasMoreElements())
d121 2
a122 2
                    paramName = (String)paramNames.nextElement ();
                    if (paramName.startsWith("Revoke"))
d124 2
a125 5
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());
                        user.revokeRole(acl, role, currentProject);
d127 1
a127 1
                }                
d129 24
a152 1
            } else if (action.equals(EDIT_ROLES_ACTION)) {
d154 1
a154 4
                while (paramNames.hasMoreElements())
                {
                    paramName = (String) paramNames.nextElement ();
                    if (paramName.startsWith ("Pending"))
d156 14
a169 12
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        User user = UserPeer.getInstance(tok.nextToken());
                        Role role = RolePeer.getInstance(tok.nextToken());

                        String value = context.getForm(paramName);
                        if (value.equals (APPROVE_FIELD_PREFIX))
                        {
                            user.approveRole(acl, role, currentProject);
                        } else if (value.equals (DISAPPROVE_FIELD_PREFIX)) {
                            user.disapproveRole(acl, role, currentProject);
                        }
d173 1
d175 4
a178 3
            Log.error("Exception thrown in ProjectMembers", e);
            appendToError(context, e.getMessage());
            throw new HandlerException(e.getMessage());
@


1.1.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
@


1.1.2.4
log
@Added new imports necessitated by Torque.
@
text
@a64 1
import org.tigris.helm.om.base.*;
@


