head	1.19;
access;
symbols
	TIGRIS_1_1_0RC2:1.8.6.1
	TIGRIS_1_1_0RC1:1.8.6.1
	TIGRIS_1_1:1.8.6.1.0.2
	TIGRIS_1_0_8:1.8.6.1
	TIGRIS_1_0_8RC3:1.8.6.1
	TIGRIS_1_0_8RC2:1.8.6.1
	TIGRIS_1_0_8RC1:1.8.6.1
	TIGRIS_1_0_7:1.8.6.1
	TIGRIS_1_0_7RC3:1.8.6.1
	TIGRIS_1_0_7RC2:1.8.6.1
	TIGRIS_1_0_7RC1:1.8.6.1
	TIGRIS_1_0_6:1.8.6.1
	TIGRIS_1_0_6RC5:1.8.6.1
	TIGRIS_1_0_6RC4:1.8.6.1
	TIGRIS_1_0_6RC3:1.8.6.1
	TIGRIS_1_0_6RC2:1.8.6.1
	TIGRIS_1_0_6RC1:1.8.6.1
	TIGRIS_1_0_5:1.8
	TIGRIS_1_0_5RC6:1.8
	TIGRIS_1_0_5RC5:1.8
	TIGRIS_1_0_5RC4:1.8
	TIGRIS_1_0_5RC3:1.8
	TIGRIS_1_0_5RC2:1.8
	TIGRIS_1_0_5RC1:1.8
	TIGRIS_1_0_4:1.8
	TIGRIS_1_0_3:1.8
	TIGRIS_1_0_2:1.8
	TIGRIS_1_0_1:1.8
	TIGRIS_1_0:1.8.0.6
	TIGRIS_1_0_0:1.8
	TIGRIS_1_0_0_RC1:1.8.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.2
	TIGRIS_0_9_2_3:1.2
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.4
	TIGRIS_0_9_2_1:1.4
	TIGRIS_0_9_2:1.2.0.2
	TIGRIS_0_9_0:1.1.0.2;
locks; strict;
comment	@# @;


1.19
date	2001.08.28.17.13.34;	author leonardr;	state Exp;
branches;
next	1.18;

1.18
date	2001.08.11.09.08.08;	author dlr;	state Exp;
branches;
next	1.17;

1.17
date	2001.07.30.19.29.57;	author leonardr;	state Exp;
branches;
next	1.16;

1.16
date	2001.07.18.10.16.29;	author dlr;	state Exp;
branches;
next	1.15;

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

1.14
date	2001.07.17.20.54.07;	author leonardr;	state Exp;
branches;
next	1.13;

1.13
date	2001.07.17.16.00.43;	author leonardr;	state Exp;
branches;
next	1.12;

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

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

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

1.9
date	2001.05.17.14.51.17;	author leonardr;	state Exp;
branches;
next	1.8;

1.8
date	2001.03.07.01.53.27;	author lucas;	state Exp;
branches
	1.8.6.1;
next	1.7;

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

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

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

1.4
date	2001.01.26.18.29.08;	author edk;	state Exp;
branches
	1.4.2.1;
next	1.3;

1.3
date	2001.01.26.05.24.07;	author edk;	state dead;
branches;
next	1.2;

1.2
date	2001.01.15.17.04.20;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2000.12.12.00.12.35;	author leonardr;	state Exp;
branches
	1.1.1.1;
next	;

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

1.4.2.1
date	2001.01.28.01.02.19;	author dlr;	state dead;
branches;
next	1.4.2.2;

1.4.2.2
date	2001.02.05.20.55.58;	author leonardr;	state Exp;
branches;
next	1.4.2.3;

1.4.2.3
date	2001.02.15.20.50.43;	author leonardr;	state Exp;
branches;
next	1.4.2.4;

1.4.2.4
date	2001.02.16.03.01.35;	author dlr;	state Exp;
branches;
next	;

1.8.6.1
date	2001.05.24.23.31.10;	author leonardr;	state Exp;
branches;
next	;


desc
@@


1.19
log
@Completed migration of more methods 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.security;

import java.util.*;
import javax.servlet.http.*;

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

import org.apache.velocity.context.Context;

import org.tigris.helm.tool.SessionManager;

import org.tigris.helm.security.RedirectException;

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

/**
 * Add some permissions to a role.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: RolePermissionAdd.java,v 1.18 2001/08/11 09:08:08 dlr Exp $
 */
public class RolePermissionAdd extends org.tigris.helm.security.HelmServlet 
{
    private static String ADD_PERMISSIONS_ACTION="Add Permissions";
    private static String RESOURCE_FIELD="resource";
    private static String ADD_ACTION_FIELD_PREFIX="Add ";

    /**
     *  Validate data and add Permissions to a Role.
     */
    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        try 
        {
            String action = getAction(context);

            // Gather any user input, adding it to the context as well.
            String resourceID = ContextAPI.processRequiredField
                (context, RESOURCE_FIELD, "Resource");

            if (ADD_PERMISSIONS_ACTION.equals(action))
            {
                if (ContextAPI.isValidUserInput(context))
                {
                    Domain currentDomain = getCurrentDomain(context);
                    AccessControlList acl = getLoginUser(context).getACL();
                    Role role = getCurrentRole(context);
                    Resource resource = ResourcePeer.getInstance(resourceID);
                    
                    List permissions = new ArrayList();
                    Enumeration paramNames = 
                        ContextAPI.getRequest(context).getParameterNames();
                    while (paramNames.hasMoreElements())
                    {
                        String paramName = (String)paramNames.nextElement();
                        
                        if (paramName.startsWith(ADD_ACTION_FIELD_PREFIX))
                        {
                            StringTokenizer tok = new StringTokenizer 
                                (paramName);
                            tok.nextToken();
                            Action newAction = ActionPeer 
                                .getInstance(tok.nextToken());
                            Permission permission = 
                                new Permission(newAction, resource);
                            
                            permissions.add(permission);
                        }                         
                    }                    

                    List projects = null;
                    List users = null;

                    for (Iterator i = permissions.iterator(); i.hasNext();)
                    {
                        Permission perm = (Permission)i.next();
                        role.addPermission(acl, perm);
                    }

                    context.put("roleID", role.getID());
                    context.put("action", "");
                    redirectTo("RoleEdit");
                } 
            }
        } 
        catch (RedirectException e) 
        {
            throw e;
        }
        catch (Exception e) 
        {
            Log.error("Exception thrown in RolePermissionAdd: ", e);
            throw new NestableException(e);
        }

        return templateName;  
    }
}
@


1.18
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d71 1
a71 1
 * @@version $Id: RolePermissionAdd.java,v 1.17 2001/07/30 19:29:57 leonardr Exp $
d105 1
a105 1
                        getRequest(context).getParameterNames();
@


1.17
log
@Stop coddling IZ in terms of user accounts; assume that IZ can get its permissions from Helm through the XML-RPC interface.
@
text
@d54 1
a54 1
import org.apache.turbine.util.TurbineException;
d71 1
a71 1
 * @@version $Id: RolePermissionAdd.java,v 1.16 2001/07/18 10:16:29 dlr Exp $
d83 1
a83 1
        throws TurbineException, RedirectException
d146 1
a146 1
            throw new TurbineException(e);
@


1.16
log
@clean up
@
text
@d71 1
a71 1
 * @@version $Id: RolePermissionAdd.java,v 1.15 2001/07/18 10:05:15 dlr Exp $
a102 1
                    boolean recalculateIssueTracking=false;
a118 4
                            if (newAction.isIssueTracking())
                            {
                                recalculateIssueTracking=true;
                            }
a130 8
                    }

                    if (recalculateIssueTracking)
                    {
                        //We need to rebuild issue tracking for the whole
                        //site.
                        Host host = getHost(context);
                        host.rebuildIssueTracking();
@


1.15
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a50 2
import java.sql.*;
import javax.servlet.*;
d71 1
a71 1
 * @@version $Id: RolePermissionAdd.java,v 1.14 2001/07/17 20:54:07 leonardr Exp $
a74 2
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.14 2001/07/17 20:54:07 leonardr Exp $";

d83 1
a83 1
	throws TurbineException, RedirectException
d85 1
a85 1
	String templateName = super.processRequest(context);
a163 1

a164 2


@


1.14
log
@Cleanup for port to new error handling system.
@
text
@d62 1
a62 1
import org.joist.security.RedirectException;
d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.13 2001/07/17 16:00:43 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.13 2001/07/17 16:00:43 leonardr Exp $";
@


1.13
log
@Ported servlets over to the new error handling system.
@
text
@d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.12 2001/07/02 18:56:42 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.12 2001/07/02 18:56:42 leonardr Exp $";
d95 1
a95 1
            String resourceID = processRequiredField
@


1.12
log
@Implemented project-scoped roles.
@
text
@a56 1
import org.apache.turbine.util.TurbineException;
d67 1
d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.11 2001/06/18 22:12:21 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.11 2001/06/18 22:12:21 leonardr Exp $";
a92 9
            // If we are returning to this page as a result of an
            // error, we just want to refresh the display, without
            // doing any further action.
            String errorMessage = (String)context.get("Error");
            if (errorMessage != null)
            {
                action = null;
                appendToMessage(context, errorMessage);
            }
d95 2
a96 4
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
            String resourceID = processField(context, RESOURCE_FIELD,
                                             "Resource", missingFields);
d98 1
a98 1
            if (action != null && action.equals(ADD_PERMISSIONS_ACTION))
d100 2
a101 2
                if (isValidUserInput(missingFields, validationErrors))
                {                    
a153 6
                else 
                {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(context, missingFields, 
                                           validationErrors);
                }
@


1.11
log
@Huge patch of the day: Got rid of redundant HELM_DOMAIN table. The project representation of the domain and the host is now the canonical one. Host and Domain now subclass ProjectGroup. The canonical representation of a project's membership in a domain group is now the corresponding mapping in HELM_PROJECT_PROJECTGROUP. Schema changes: No more HELM_DOMAIN table (obviously); no more DOMAIN_ID in HELM_PROJECT; HELM_USER and HELM_VC_VIEW now have foreign keys in HELM_PROJECT instead of HELM_DOMAIN.
@
text
@d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.10 2001/05/23 01:50:20 dlr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.10 2001/05/23 01:50:20 dlr Exp $";
d150 1
a150 1
                        role.addPermission(acl, currentDomain, perm);
d164 3
a166 1
                } else {
d172 3
a174 1
        } catch (RedirectException e) {
d176 3
a178 1
        } catch (Exception e) {
d186 1
a186 1
} /* end class RolePermissionAdd */
@


1.10
log
@Ported Helm from WebMacro to Velocity.
@
text
@d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.9 2001/05/17 14:51:17 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.9 2001/05/17 14:51:17 leonardr Exp $";
d157 1
a157 1
                        Project host = getHost(context).getSpecialProject();
@


1.9
log
@Refactored a lot of code to get rid of the good-looking but very slow IssueTrackingAccount{Descriptor,Map} classes. Also cleaned up the script-running interface quite a bit.
@
text
@d56 2
d59 1
a59 1
import org.webmacro.servlet.*;
d61 1
a61 1
import org.joist.session.*;
d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.8 2001/03/07 01:53:27 lucas Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.8 2001/03/07 01:53:27 lucas Exp $";
d86 2
a87 2
    protected String processRequest (Connection connection, WebContext context)
	throws HandlerException, RedirectException
d89 1
a89 1
	String templateName = super.processRequest(connection, context);
d121 1
a121 1
                        context.getRequest().getParameterNames();
d174 1
a174 1
            throw new HandlerException(e.getMessage());
@


1.8
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@a65 1
import org.tigris.helm.tool.task.IssueTrackingAccountDescriptor;
d71 1
a71 1
 * @@version $Id: RolePermissionAdd.java,v 1.7 2001/03/02 00:37:47 leonardr Exp $
d75 1
a75 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.7 2001/03/02 00:37:47 leonardr Exp $";
a141 3

                    IssueTrackingAccountDescriptor before = null;
                    IssueTrackingAccountDescriptor after = null;
a143 9
                    if (recalculateIssueTracking)
                    {
                        //All projects and users on the site are affected.
                        projects = getHost(context)
                            .getSpecialProject().expand();
                        users = getHost(context).getAllSiteUsers();
                        before = new IssueTrackingAccountDescriptor
                            (projects, users);
                    }
d153 4
a156 3
                        after = new IssueTrackingAccountDescriptor
                            (projects, users);
                        before.syncTo(after, acl.getUser());
@


1.8.6.1
log
@Ported task running system in from HEAD.
@
text
@d66 1
d72 1
a72 1
 * @@version $Id: RolePermissionAdd.java,v 1.8 2001/03/07 01:53:27 lucas Exp $
d76 1
a76 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.8 2001/03/07 01:53:27 lucas Exp $";
d143 3
d148 9
d166 3
a168 2
                        getHost(context).getSpecialProject()
                            .rebuildIssueTracking();
@


1.7
log
@Redirect back to RoleEdit.
@
text
@a65 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d72 1
a72 1
 * @@version $Id: RolePermissionAdd.java,v 1.6 2001/02/26 22:03:26 leonardr Exp $
d76 1
a76 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.6 2001/02/26 22:03:26 leonardr Exp $";
@


1.6
log
@Almost got rid of dependance on hacky one-argument IssueTrackingAccountDescriptor.syncto().
@
text
@d74 1
a74 1
 * @@version $Id: RolePermissionAdd.java,v 1.5 2001/02/21 01:08:25 dlr Exp $
d78 1
a78 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.5 2001/02/21 01:08:25 dlr Exp $";
d116 1
a116 1
                    Role currentRole = getCurrentRole(context);
a159 1

d163 1
a163 1
                        currentRole.addPermission(acl, currentDomain, perm);
d173 3
a175 3
                    redirectToURL
                        (context, currentDomain.getDomainHomeServletURL
                         ("RoleList"));
d182 2
@


1.5
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d74 1
a74 1
 * @@version $Id: RolePermissionAdd.java,v 1.4.2.4 2001/02/16 03:01:35 dlr Exp $
d78 1
a78 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.4.2.4 2001/02/16 03:01:35 dlr Exp $";
d171 1
a171 1
                        before.syncTo(after);
@


1.4
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d55 2
a56 1
import org.webmacro.util.*;
a58 2
import org.joist.*;
import org.joist.util.*;
a60 2
import com.workingdogs.village.*;

a61 1
import org.joist.database.*;
a63 1
import org.tigris.helm.domain.*;
d65 4
a68 1
import org.tigris.helm.tool.IssueTrackingAccountDescriptor;
d71 1
a71 1
 * Create a new Role.
d74 1
a74 1
 * @@version $Id: RolePermissionAdd.java,v 1.2 2001/01/15 17:04:20 leonardr Exp $
d78 1
a78 4
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.2 2001/01/15 17:04:20 leonardr Exp $";

    private static Log log = new Log("RolePAdd", "Role Permission Add Servlet");
    private static boolean debug = true;
d105 2
a106 2
            ArrayList missingFields = new ArrayList();
            ArrayList validationErrors = new ArrayList();
a108 1
            
d117 2
a118 3
                    Resource resource = new Resource(connection, dMgr, 
                                                     resourceID);

d120 2
a121 2
                    ArrayList permissions = new ArrayList();
                    Enumeration paramNames =
d125 1
a125 1
                        String paramName = (String) paramNames.nextElement();
d131 3
a133 3
                            tok.nextToken ();
                            Action newAction = new Action(connection, dMgr, 
                                                          tok.nextToken());
d135 1
a135 2
                                new Permission(connection, dMgr, newAction, 
                                               resource);
d153 2
a154 1
                        projects = getHost(context).getSpecialProject().expand();
a160 1

d171 1
a171 1
                        before.syncTo(connection, dMgr, after);
d183 2
a184 11
        } catch (DataSetException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (SQLException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (JoistDatabaseException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (DoesNotExist e) {
            log.exception(e);
@


1.4.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d76 1
a76 1
 * @@version $Id: RolePermissionAdd.java,v 1.4 2001/01/26 18:29:08 edk Exp $
d80 1
a80 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.4 2001/01/26 18:29:08 edk Exp $";
@


1.4.2.2
log
@Ported RolePermissionAdd servlet.
@
text
@d55 1
a55 2
import org.apache.turbine.util.Log;

d58 2
d62 2
d65 1
d68 1
d70 1
a70 3
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.tool.task.IssueTrackingAccountDescriptor;
d73 1
a73 1
 * Add some permissions to a role.
d82 3
d110 2
a111 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d114 1
d123 3
a125 2
                    Resource resource = ResourcePeer.getInstance(resourceID);
                    
d127 2
a128 2
                    List permissions = new ArrayList();
                    Enumeration paramNames = 
d132 1
a132 1
                        String paramName = (String)paramNames.nextElement();
d138 3
a140 3
                            tok.nextToken();
                            Action newAction = ActionPeer 
                                .getInstance(tok.nextToken());
d142 2
a143 1
                                new Permission(newAction, resource);
d161 1
a161 2
                        projects = getHost(context)
                            .getSpecialProject().expand();
d168 1
d179 1
a179 1
                        before.syncTo(after);
d191 11
a201 2
        } catch (Exception e) {
            Log.error("Exception thrown in RolePermissionAdd: ", e);
@


1.4.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.4.2.2 2001/02/05 20:55:58 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.4.2.2 2001/02/05 20:55:58 leonardr Exp $";
@


1.4.2.4
log
@Added new imports necessitated by Torque.
@
text
@a66 1
import org.tigris.helm.om.base.*;
d73 1
a73 1
 * @@version $Id: RolePermissionAdd.java,v 1.4.2.3 2001/02/15 20:50:43 leonardr Exp $
d77 1
a77 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.4.2.3 2001/02/15 20:50:43 leonardr Exp $";
@


1.3
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@@


1.2
log
@Recalculate issue tracking accounts after adding or removing issue tracking permissions to or from a role.
@
text
@d76 1
a76 1
 * @@version $Id: RolePermissionAdd.java,v 1.1 2000/12/12 00:12:35 leonardr Exp $
d80 1
a80 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.1 2000/12/12 00:12:35 leonardr Exp $";
@


1.1
log
@New servlet: RolePermissionAdd
@
text
@d70 1
d76 1
a76 1
 * @@version $Id: RolePermissionAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $
d80 1
a80 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $";
d126 1
d136 2
a137 1
                            StringTokenizer tok = new StringTokenizer (paramName);
d144 4
d153 16
d174 8
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d55 1
a55 2
import org.apache.turbine.util.Log;

d58 2
d62 2
d65 1
d68 1
a69 4
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
import org.tigris.helm.tool.task.IssueTrackingAccountDescriptor;
d72 1
a72 1
 * Add some permissions to a role.
d75 1
a75 1
 * @@version $Id: RolePermissionAdd.java,v 1.4.2.4 2001/02/16 03:01:35 dlr Exp $
d79 4
a82 1
    public static final  String versionID = "$Id: RolePermissionAdd.java,v 1.4.2.4 2001/02/16 03:01:35 dlr Exp $";
d109 2
a110 2
            List missingFields = new ArrayList();
            List validationErrors = new ArrayList();
d113 1
d122 5
a126 5
                    Resource resource = ResourcePeer.getInstance(resourceID);
                    
                    boolean recalculateIssueTracking=false;
                    List permissions = new ArrayList();
                    Enumeration paramNames = 
d130 1
a130 1
                        String paramName = (String)paramNames.nextElement();
d134 4
a137 5
                            StringTokenizer tok = new StringTokenizer 
                                (paramName);
                            tok.nextToken();
                            Action newAction = ActionPeer 
                                .getInstance(tok.nextToken());
d139 2
a140 5
                                new Permission(newAction, resource);
                            if (newAction.isIssueTracking())
                            {
                                recalculateIssueTracking=true;
                            }
a145 16

                    IssueTrackingAccountDescriptor before = null;
                    IssueTrackingAccountDescriptor after = null;
                    List projects = null;
                    List users = null;
                    if (recalculateIssueTracking)
                    {
                        //All projects and users on the site are affected.
                        projects = getHost(context)
                            .getSpecialProject().expand();
                        users = getHost(context).getAllSiteUsers();
                        before = new IssueTrackingAccountDescriptor
                            (projects, users);
                    }


a150 8

                    if (recalculateIssueTracking)
                    {
                        after = new IssueTrackingAccountDescriptor
                            (projects, users);
                        before.syncTo(after);
                    }

d160 11
a170 2
        } catch (Exception e) {
            Log.error("Exception thrown in RolePermissionAdd: ", e);
@


