head	1.19;
access;
symbols
	TIGRIS_1_1_0RC2:1.9
	TIGRIS_1_1_0RC1:1.9
	TIGRIS_1_1:1.9.0.4
	TIGRIS_1_0_8:1.9
	TIGRIS_1_0_8RC3:1.9
	TIGRIS_1_0_8RC2:1.9
	TIGRIS_1_0_8RC1:1.9
	TIGRIS_1_0_7:1.9
	TIGRIS_1_0_7RC3:1.9
	TIGRIS_1_0_7RC2:1.9
	TIGRIS_1_0_7RC1:1.9
	TIGRIS_1_0_6:1.9
	TIGRIS_1_0_6RC5:1.9
	TIGRIS_1_0_6RC4:1.9
	TIGRIS_1_0_6RC3:1.9
	TIGRIS_1_0_6RC2:1.9
	TIGRIS_1_0_6RC1:1.9
	TIGRIS_1_0_5:1.9
	TIGRIS_1_0_5RC6:1.9
	TIGRIS_1_0_5RC5:1.9
	TIGRIS_1_0_5RC4:1.9
	TIGRIS_1_0_5RC3:1.9
	TIGRIS_1_0_5RC2:1.9
	TIGRIS_1_0_5RC1:1.9
	TIGRIS_1_0_4:1.9
	TIGRIS_1_0_3:1.9
	TIGRIS_1_0_2:1.9
	TIGRIS_1_0_1:1.9
	TIGRIS_1_0:1.9.0.6
	TIGRIS_1_0_0:1.9
	TIGRIS_1_0_0_RC1:1.9.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.5
	TIGRIS_0_9_2_1:1.5
	TIGRIS_0_9_2:1.2.0.4
	TIGRIS_0_9_0:1.2.0.2;
locks; strict;
comment	@# @;


1.19
date	2001.08.28.00.56.13;	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.26.18.22.08;	author leonardr;	state Exp;
branches;
next	1.16;

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

1.15
date	2001.07.17.16.00.43;	author leonardr;	state Exp;
branches;
next	1.14;

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

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

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

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

1.10
date	2001.05.01.21.47.22;	author leonardr;	state Exp;
branches;
next	1.9;

1.9
date	2001.03.07.01.53.27;	author lucas;	state Exp;
branches;
next	1.8;

1.8
date	2001.03.01.20.23.55;	author leonardr;	state Exp;
branches;
next	1.7;

1.7
date	2001.02.21.01.08.25;	author dlr;	state Exp;
branches;
next	1.6;

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

1.5
date	2001.01.26.18.29.08;	author edk;	state Exp;
branches
	1.5.2.1;
next	1.4;

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

1.3
date	2001.01.24.20.42.49;	author dlr;	state Exp;
branches;
next	1.2;

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

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

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

1.5.2.1
date	2001.01.28.01.02.19;	author dlr;	state dead;
branches;
next	1.5.2.2;

1.5.2.2
date	2001.02.02.19.27.46;	author leonardr;	state Exp;
branches;
next	1.5.2.3;

1.5.2.3
date	2001.02.09.16.05.17;	author leonardr;	state Exp;
branches;
next	1.5.2.4;

1.5.2.4
date	2001.02.15.20.50.43;	author leonardr;	state Exp;
branches;
next	1.5.2.5;

1.5.2.5
date	2001.02.16.03.01.35;	author dlr;	state Exp;
branches;
next	1.5.2.6;

1.5.2.6
date	2001.02.20.04.14.50;	author dlr;	state Exp;
branches;
next	1.5.2.7;

1.5.2.7
date	2001.02.20.04.15.35;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.19
log
@Moved code out of BaseHelmServlet and into other classes which suit it better.
@
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 java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.turbine.util.Log;
import org.apache.commons.util.StringUtils;
import org.apache.commons.util.exception.NestableException;
import org.apache.velocity.context.Context;

import org.tigris.helm.security.RedirectException;

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

/**
 * Create a new Role.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: RoleAdd.java,v 1.18 2001/08/11 09:08:08 dlr Exp $
 */
public class RoleAdd extends org.tigris.helm.security.HelmServlet 
{
    /**
     * Action which triggers role creation.
     */
    private static String CREATE_ROLE_ACTION = "Create Role";

    /**
     * Field containing the ID of the project with which the new
     * role is to be associated. 
     */
    private static String ASSOCIATED_PROJECT_FIELD = "associatedProject"; 

    /**
     * Field containing the name of the new role.
     */
    private static String NAME_FIELD = "name";

    /**
     * Field containing the description of the new role.
     */
    private static String DESCRIPTION_FIELD = "description";

    /**
     * Field containing the type of the new role.
     */
    private static String TYPE_FIELD = "type";

    /**
     * Field containing the ID of the role to clone to get this role's
     * permissions.
     */
    private static String SOURCE_ROLE_FIELD = "source";

    private static String ADD_ACTION_FIELD_PREFIX = "Add ";   

    private static String ADD_RESOURCE_FIELD_PREFIX = "Resource for ";

    private static String ROLE_ATTRIBUTE_PREFIX = "ROLE-ATTRIBUTE ";

    /**
     * Default role type.
     */
    private static String DEFAULT_ROLE_TYPE = Role.PROJECT_TYPE;

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

            Project currentProject = getCurrentProject(context);

            // Gather any user input, adding it to the context as well.
            String type = ContextAPI.processField
                (context, TYPE_FIELD, DEFAULT_ROLE_TYPE);
            String name = ContextAPI.processRequiredField
                (context, NAME_FIELD, "Role name");
            String description = ContextAPI.processRequiredField
                (context, DESCRIPTION_FIELD, "Description");
            String sourceID = ContextAPI.processField
                (context, SOURCE_ROLE_FIELD, (String)null);

            String associatedProjectID = ContextAPI.processField
                (context, ASSOCIATED_PROJECT_FIELD, currentProject.getID());
            Project associatedProject = ProjectPeer.getInstance
                (associatedProjectID);

            if (CREATE_ROLE_ACTION.equals(action))
            {
                Map attributes = new HashMap();
                List permissions = null;

                //If they started out with a source ID, get all its
                //permissions.
                if (StringUtils.isValid(sourceID))
                {                
                    Role source = RolePeer.getInstance(sourceID);
                    permissions = source.getPermissions();
                }
                else
                {
                    permissions = new ArrayList();
                }

                //Add all the explicitly specified permissions.
                List permissionList = ContextAPI.searchParamsForPrefix
                    (context, ADD_ACTION_FIELD_PREFIX);
                for (Iterator i = permissionList.iterator(); i.hasNext();)
                {
                    String actionID = (String)i.next();
                    Action newAction = ActionPeer.getInstance(actionID);
                    String resourceID = ContextAPI.processRequiredField
                        (context, 
                         ADD_RESOURCE_FIELD_PREFIX + newAction.getID(), 
                         "Resource for action " + newAction.getName());
                    if (StringUtils.isValid(resourceID))
                    {
                        Resource resource = ResourcePeer
                            .getInstance(resourceID);
                        Permission permission = 
                            new Permission(newAction, resource);
                        permissions.add(permission);
                    }
                }
                
                List attributeList = ContextAPI.searchParamsForPrefix
                    (context, ROLE_ATTRIBUTE_PREFIX);
                for (Iterator i = attributeList.iterator(); i.hasNext();)
                {
                    String attributeName = (String)i.next();
                    String attributeValue = ContextAPI.processField
                        (context, ROLE_ATTRIBUTE_PREFIX + attributeName);
                    if (attributeValue.equals("on"))
                    {
                        attributeValue=DBFlag.ON;
                    }
                    attributes.put(attributeName, attributeValue);
                }
                
                AccessControlList acl = getLoginUser(context).getACL();

                if (ContextAPI.isValidUserInput(context))
                {
                    Role g = Role.add
                        (acl, associatedProject, name, description, type, 
                         permissions, attributes);
                    redirectToURL
                        (context, currentProject.getProjectPageURL
                         ("RoleList"));
                }
            }
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            Log.debug("Exception in RoleAdd: ", e);
            throw new NestableException (e);
        }

        return templateName;  
    }

} /* end class RoleAdd */


@


1.18
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.17 2001/07/26 18:22:08 leonardr Exp $
d164 1
a164 1
                List permissionList = searchParamsForPrefix
d184 1
a184 1
                List attributeList = searchParamsForPrefix
@


1.17
log
@Fixed RoleAdd and also allowed you to specify additional permissions when cloning a role.
@
text
@d55 2
a56 2
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.TurbineException;
d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.16 2001/07/18 10:05:15 dlr Exp $
d122 1
a122 1
	throws TurbineException, RedirectException
d218 1
a218 1
            throw new TurbineException (e);
@


1.16
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.15 2001/07/17 16:00:43 leonardr Exp $
d109 1
a109 1
    private static String ADD_RESOURCE_FIELD_PREFIX = "Resource For ";
d150 3
d161 14
a174 3
                    List permissionList = searchParamsForPrefix
                        (context, ADD_ACTION_FIELD_PREFIX);
                    for (Iterator i = permissionList.iterator(); i.hasNext();)
d176 5
a180 14
                        String actionID = (String)i.next();
                        Action newAction = ActionPeer.getInstance(actionID);
                        String resourceID = ContextAPI.processRequiredField
                            (context, 
                             ADD_RESOURCE_FIELD_PREFIX + newAction.getID(), 
                             "Resource for action " + newAction.getName());
                        if (StringUtils.isValid(resourceID))
                        {
                            Resource resource = ResourcePeer
                                .getInstance(resourceID);
                            Permission permission = 
                                new Permission(newAction, resource);
                            permissions.add(permission);
                        }
@


1.15
log
@Ported servlets over to the new error handling system.
@
text
@d59 1
a59 1
import org.joist.security.RedirectException;
d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.14 2001/07/16 23:22:09 leonardr Exp $
@


1.14
log
@More changes to and first use of new error-handling system.
@
text
@d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.13 2001/07/02 18:56:42 leonardr Exp $
d203 1
a203 1
                } 
@


1.13
log
@Implemented project-scoped roles.
@
text
@d65 1
d71 1
a71 1
 * @@version $Id: RoleAdd.java,v 1.12 2001/06/19 21:54:58 leonardr Exp $
a127 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);
            }
d132 8
a139 9
            ArrayList missingFields = new ArrayList();
            ArrayList validationErrors = new ArrayList();
            String type = processField(context, TYPE_FIELD, DEFAULT_ROLE_TYPE);
            String name = processField(context, NAME_FIELD,
                                       "Role name", missingFields);
            String description = processField(context, DESCRIPTION_FIELD,
                                              "Description", missingFields);
            String sourceID = processField(context, SOURCE_ROLE_FIELD, 
                                           (String)null);
d141 1
a141 1
            String associatedProjectID = processField
d164 1
a164 1
                        String resourceID = processField
d167 1
a167 2
                             "Resource for action " + newAction.getName(), 
                             missingFields);
d184 2
a185 3
                    String attributeValue =
                        processField(context, ROLE_ATTRIBUTE_PREFIX 
                                     + attributeName);                    
d195 1
a195 1
                if (isValidUserInput(missingFields, validationErrors))
a203 6
                else 
                {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(context, missingFields, 
                                           validationErrors);
                }
d205 3
a207 1
        } catch (RedirectException e) {
d209 3
a211 1
        } catch (Exception e) {
d213 1
a213 1
            throw new TurbineException(e);
@


1.12
log
@Added the capability for a new role to clone an existing role.
@
text
@d64 1
d70 1
a70 1
 * @@version $Id: RoleAdd.java,v 1.11 2001/05/23 01:50:20 dlr Exp $
d74 3
d78 10
d89 4
d94 4
d99 5
d105 1
d107 1
d112 4
a115 1
    private static String DEFAULT_ROLE_TYPE = "Project";
a125 2
            String type = processField(context, TYPE_FIELD, DEFAULT_ROLE_TYPE);

d137 2
d142 1
d150 6
a155 1
            if (action != null && action.equals(CREATE_ROLE_ACTION))
a177 1
                        Log.debug("ResourceID: " + resourceID);
d196 5
a200 1
                                     + attributeName);
a203 1
                Domain currentDomain = getCurrentDomain(context);
d209 1
a209 1
                        (acl, currentDomain, name, description, type, 
d212 1
a212 1
                        (context, currentDomain.getDomainHomeServletURL
@


1.11
log
@Ported Helm from WebMacro to Velocity.
@
text
@d55 1
a55 1
import org.apache.turbine.util.TurbineException;
d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.10 2001/05/01 21:47:22 leonardr Exp $
d77 1
d81 1
a81 1
    private static String ROLE_ATTRIBUTE_PREFIX = "ROLE-ATTRIBUTE";
d114 2
d120 7
a126 4
                List permissions = new ArrayList();
                Enumeration paramNames =
                    getRequest(context).getParameterNames();
                while (paramNames.hasMoreElements())
d128 4
a131 3
                    String paramName = (String)paramNames.nextElement();

                    if (paramName.startsWith(ROLE_ATTRIBUTE_PREFIX))
d133 2
a134 13
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        String attributeName = tok.nextToken();
                        String attributeValue =
                            processField(context, paramName);
                        attributes.put(attributeName, attributeValue);
                    }
                    else if (paramName.startsWith(ADD_ACTION_FIELD_PREFIX))
                    {
                        StringTokenizer tok = new StringTokenizer(paramName);
                        tok.nextToken();
                        Action newAction = 
                            ActionPeer.getInstance(tok.nextToken());
d136 2
a137 2
                            (context, ADD_RESOURCE_FIELD_PREFIX 
                             + newAction.getID(), 
d140 2
a141 1
                        if (resourceID != null)
d148 1
a148 1
                        }                         
d150 12
a161 1
                }    
@


1.10
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
@d55 3
a57 1
import org.webmacro.servlet.*;
d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.9 2001/03/07 01:53:27 lucas Exp $
d87 2
a88 2
    protected String processRequest (Connection connection, WebContext context)
	throws HandlerException, RedirectException
d90 1
a90 1
	String templateName = super.processRequest(connection, context);
d119 1
a119 1
                    context.getRequest().getParameterNames();
d178 1
a178 1
            throw new HandlerException(e.getMessage());
@


1.9
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d67 1
a67 1
 * @@version $Id: RoleAdd.java,v 1.8 2001/03/01 20:23:55 leonardr Exp $
a74 2
    private static String REQUESTABLE_FIELD = "requestable";
    private static String DENOTES_OWNER_FIELD = "owner";
d78 2
a110 2
            boolean requestable = processCheckbox(context, REQUESTABLE_FIELD);
            boolean denotesOwner = processCheckbox(context, DENOTES_OWNER_FIELD);
d114 1
d122 1
a122 1
                    if (paramName.startsWith(ADD_ACTION_FIELD_PREFIX))
d125 12
a136 2
                        tok.nextToken ();
                        Action newAction = ActionPeer.getInstance(tok.nextToken());
d144 2
a145 1
                            Resource resource = ResourcePeer.getInstance(resourceID);
d160 1
a160 1
                         requestable, denotesOwner, permissions);
d164 3
a166 1
                } else {
d172 2
@


1.8
log
@Bad space! Bad!
@
text
@a60 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d67 1
a67 1
 * @@version $Id: RoleAdd.java,v 1.7 2001/02/21 01:08:25 dlr Exp $
@


1.7
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.5.2.7 2001/02/20 04:15:35 dlr Exp $
d76 1
a76 1
    private static String TYPE_FIELD =" type";
d82 2
d93 2
a112 1
            String type = processField(context, TYPE_FIELD, "Project");
@


1.6
log
@Added a new field to the Role table: ownership. This designates whether someone who has the role in the project/domain/host is the sort of person who gets emails when something happens that affects the project/domain/host.
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
a46 1

d54 1
a54 1
import org.webmacro.util.*;
a56 6
import org.joist.*;
import org.joist.util.*;
import org.joist.session.*;

import com.workingdogs.village.*;

a57 1
import org.joist.database.*;
d60 3
a62 1
import org.tigris.helm.domain.*;
d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.5 2001/01/26 18:29:08 edk Exp $
d73 8
a80 13
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5 2001/01/26 18:29:08 edk Exp $";

    private static Log log = new Log("ResAdd", "Role Add Servlet");
    private static boolean debug = true;

    private static String CREATE_ROLE_ACTION="Create Role";
    private static String NAME_FIELD="name";
    private static String DESCRIPTION_FIELD="description";
    private static String TYPE_FIELD="type";
    private static String REQUESTABLE_FIELD="requestable";
    private static String OWNERSHIP_FIELD="ownership";
    private static String ADD_ACTION_FIELD_PREFIX="Add ";   
    private static String ADD_RESOURCE_FIELD_PREFIX="Resource For ";
d108 1
a108 1
                                       "Description", missingFields);
d110 2
a111 3
            String requestableS = processField(context, REQUESTABLE_FIELD, "");
            boolean requestable = !requestableS.equals("");
            boolean ownership = processCheckbox(context, OWNERSHIP_FIELD);            
d115 1
a115 1
                ArrayList permissions = new ArrayList();
d120 1
a120 1
                    String paramName = (String) paramNames.nextElement();
d124 1
a124 1
                        StringTokenizer tok = new StringTokenizer (paramName);
d126 1
a126 2
                        Action newAction = new Action(connection, dMgr, 
                                                   tok.nextToken());
d134 1
a134 2
                            Resource resource = new Resource(connection, dMgr,
                                                             resourceID);
d136 1
a136 2
                                new Permission(connection, dMgr, newAction, 
                                               resource);
d147 3
a149 3
                    Role g = new Role
                        (connection, dMgr, acl, currentDomain,
                         name, description, type, requestable, ownership, permissions);
d159 2
a160 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.5
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $";
d89 1
d123 2
a124 1
            
d164 1
a164 1
                         name, description, type, requestable, permissions);
@


1.5.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.5 2001/01/26 18:29:08 edk Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5 2001/01/26 18:29:08 edk Exp $";
@


1.5.2.2
log
@Ported RoleAdd servlet and infrastructure for same.
@
text
@d47 1
d55 1
a55 1
import org.apache.turbine.util.Log;
d58 6
d65 1
d68 1
a68 2
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d81 3
d118 1
a118 1
                                              "Description", missingFields);
d120 2
a121 1
            boolean requestable = processCheckbox(context, REQUESTABLE_FIELD);
d125 1
a125 1
                List permissions = new ArrayList();
d130 1
a130 1
                    String paramName = (String)paramNames.nextElement();
d134 1
a134 1
                        StringTokenizer tok = new StringTokenizer(paramName);
d136 2
a137 1
                        Action newAction = ActionPeer.getInstance(tok.nextToken());
d145 2
a146 1
                            Resource resource = ResourcePeer.getInstance(resourceID);
d148 2
a149 1
                                new Permission(newAction, resource);
d160 3
a162 3
                    Role g = Role.add
                        (acl, currentDomain, name, description, type, 
                         requestable, permissions);
d172 11
a182 2
        } catch (Exception e) {
            Log.debug("Exception in RoleAdd: ", e);
@


1.5.2.3
log
@Changed role methods to use the ownership field.
@
text
@d68 1
a68 1
 * @@version $Id: RoleAdd.java,v 1.5.2.2 2001/02/02 19:27:46 leonardr Exp $
d72 1
a72 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5.2.2 2001/02/02 19:27:46 leonardr Exp $";
a78 1
    private static String DENOTES_OWNER_FIELD="owner";
d111 1
a111 2
            boolean denotesOwner = processCheckbox(context, DENOTES_OWNER_FIELD);

d148 1
a148 1
                         requestable, denotesOwner, permissions);
@


1.5.2.4
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d68 1
a68 1
 * @@version $Id: RoleAdd.java,v 1.5.2.3 2001/02/09 16:05:17 leonardr Exp $
d72 1
a72 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5.2.3 2001/02/09 16:05:17 leonardr Exp $";
@


1.5.2.5
log
@Added new imports necessitated by Torque.
@
text
@a61 1
import org.tigris.helm.om.base.*;
d68 1
a68 1
 * @@version $Id: RoleAdd.java,v 1.5.2.4 2001/02/15 20:50:43 leonardr Exp $
d72 1
a72 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5.2.4 2001/02/15 20:50:43 leonardr Exp $";
@


1.5.2.6
log
@Added spaces between variable, equals sign, and value.
@
text
@d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.5.2.5 2001/02/16 03:01:35 dlr Exp $
d73 1
a73 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.5.2.5 2001/02/16 03:01:35 dlr Exp $";
d75 8
a82 8
    private static String CREATE_ROLE_ACTION = "Create Role";
    private static String NAME_FIELD = "name";
    private static String DESCRIPTION_FIELD = "description";
    private static String TYPE_FIELD =" type";
    private static String REQUESTABLE_FIELD = "requestable";
    private static String DENOTES_OWNER_FIELD = "owner";
    private static String ADD_ACTION_FIELD_PREFIX = "Add ";   
    private static String ADD_RESOURCE_FIELD_PREFIX = "Resource For ";
@


1.5.2.7
log
@Removed versionID field.
@
text
@d69 1
a69 1
 * @@version $Id: RoleAdd.java,v 1.5.2.6 2001/02/20 04:14:50 dlr Exp $
d73 2
@


1.4
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
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.3 2001/01/24 20:42:49 dlr Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.3 2001/01/24 20:42:49 dlr Exp $";
d172 7
a178 1
        } catch (DoesNotExist e) {
d181 1
a181 1
        } catch (DBException e) {
@


1.3
log
@Making use of DBException.
@
text
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.2 2000/12/08 16:59:43 leonardr Exp $";
@


1.2
log
@RoleAdd can now set all the fields in Helm's role table.
@
text
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.1 2000/12/08 02:19:04 leonardr Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.1 2000/12/08 02:19:04 leonardr Exp $";
d172 1
a172 4
        } catch (DataSetException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (SQLException e) {
d175 1
a175 4
        } catch (JoistDatabaseException e) {
            log.exception(e);
            throw new HandlerException(e.getMessage());
        } catch (DoesNotExist e) {
@


1.1
log
@First stab at dynamic role creation.
@
text
@d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.1 2000/12/07 18:26:08 leonardr Exp $
d79 1
a79 1
    public static final  String versionID = "$Id: RoleAdd.java,v 1.1 2000/12/07 18:26:08 leonardr Exp $";
d86 1
d88 1
d117 2
d120 2
d162 1
a162 1
                         name, type, permissions);
@


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.
d47 1
d55 1
a55 1
import org.apache.turbine.util.Log;
d58 6
d65 1
d68 1
a68 3
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d75 1
a75 1
 * @@version $Id: RoleAdd.java,v 1.5.2.7 2001/02/20 04:15:35 dlr Exp $
d79 10
a88 8
    private static String CREATE_ROLE_ACTION = "Create Role";
    private static String NAME_FIELD = "name";
    private static String DESCRIPTION_FIELD = "description";
    private static String TYPE_FIELD =" type";
    private static String REQUESTABLE_FIELD = "requestable";
    private static String DENOTES_OWNER_FIELD = "owner";
    private static String ADD_ACTION_FIELD_PREFIX = "Add ";   
    private static String ADD_RESOURCE_FIELD_PREFIX = "Resource For ";
a114 2
            String description = processField(context, DESCRIPTION_FIELD,
                                              "Description", missingFields);
d116 1
a116 3
            boolean requestable = processCheckbox(context, REQUESTABLE_FIELD);
            boolean denotesOwner = processCheckbox(context, DENOTES_OWNER_FIELD);

d119 1
a119 1
                List permissions = new ArrayList();
d124 1
a124 1
                    String paramName = (String)paramNames.nextElement();
d128 1
a128 1
                        StringTokenizer tok = new StringTokenizer(paramName);
d130 2
a131 1
                        Action newAction = ActionPeer.getInstance(tok.nextToken());
d139 2
a140 1
                            Resource resource = ResourcePeer.getInstance(resourceID);
d142 2
a143 1
                                new Permission(newAction, resource);
d154 3
a156 3
                    Role g = Role.add
                        (acl, currentDomain, name, description, type, 
                         requestable, denotesOwner, permissions);
d166 11
a176 2
        } catch (Exception e) {
            Log.debug("Exception in RoleAdd: ", e);
@


