head	1.13;
access;
symbols
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.8
	TIGRIS_0_9_2_3:1.8
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.10
	TIGRIS_0_9_2_1:1.10
	TIGRIS_0_9_2:1.8.0.6
	TIGRIS_0_9_0:1.8.0.4
	TIGRIS_0_8_4:1.8.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.13
date	2001.03.09.23.33.12;	author leonardr;	state dead;
branches;
next	1.12;

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

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

1.10
date	2001.01.26.18.29.09;	author edk;	state Exp;
branches
	1.10.2.1;
next	1.9;

1.9
date	2001.01.26.05.24.08;	author edk;	state dead;
branches;
next	1.8;

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

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

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

1.5
date	2000.11.27.21.30.27;	author leonardr;	state Exp;
branches;
next	1.4;

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

1.3
date	2000.11.14.00.08.36;	author leonardr;	state Exp;
branches;
next	1.2;

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

1.1
date	2000.11.12.21.16.41;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.16.41;	author dlr;	state Exp;
branches;
next	1.1.1.2;

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

1.10.2.1
date	2001.01.28.01.02.19;	author dlr;	state dead;
branches;
next	1.10.2.2;

1.10.2.2
date	2001.01.30.07.34.54;	author dlr;	state Exp;
branches;
next	1.10.2.3;

1.10.2.3
date	2001.01.31.01.44.20;	author dlr;	state Exp;
branches;
next	1.10.2.4;

1.10.2.4
date	2001.02.12.16.24.33;	author leonardr;	state Exp;
branches;
next	1.10.2.5;

1.10.2.5
date	2001.02.15.20.50.44;	author leonardr;	state Exp;
branches;
next	;


desc
@@


1.13
log
@This tool is no longer used or useful.
@
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.tool;

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

import org.tigris.helm.*;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.*;

public class AccessControlledDatabaseFilter
{
    public static List getViewableProjects(AccessControlList acl,
                                           List projects)
        throws DoesNotExist
    {
        return filterProjects(acl, projects, "Project Page - View");
                            
    }

    public static List getContentViewableProjects(AccessControlList acl, 
                                                  List projects)
        throws DoesNotExist
    {
        return filterProjects(acl, projects, "Project Content - View");
    }

    public static List filterProjects(AccessControlList acl, List projects,
                                      String action)
        throws DoesNotExist
    {
        ArrayList accessibleProjects = new ArrayList();
//         for (Iterator i = projects.iterator(); i.hasNext();)
//         {
//             Project p = (Project)i.next();
//             if (acl.hasPermission(action, p.getID()))
//             {
//                 accessibleProjects.add(p);
//             }
//         }       
//         Collections.sort(accessibleProjects);
        return accessibleProjects;
    }
}


@


1.12
log
@jr informs me that you should be able to see projects in lists if you have Project Page - View, not Project - View.
@
text
@@


1.11
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d62 1
a62 1
        return filterProjects(acl, projects, "Project - View");
@


1.10
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.
d52 3
a54 2
import com.workingdogs.village.*;
import org.webmacro.util.Log;
d56 1
a56 8
import org.joist.database.*;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.project.Project;
import org.tigris.helm.database.*;
import org.tigris.helm.security.AccessControlList;

public class AccessControlledDatabaseFilter extends Object
d58 1
a58 15
    static public Log log = new Log("ACDF", "AccessControlledDatabaseFilter");
    static private boolean debug = true;

    public static List getViewableProjects(Connection connection,
                                           DataManager dMgr,
                                           AccessControlList acl, 
                                           DataSet projects)
        throws DataSetException, DoesNotExist
    {
        return AccessControlledDatabaseFilter
            .filterProjects(connection, dMgr, acl, projects, 
                            "Project - View");
    }

    public static List getViewableProjects(AccessControlList acl, 
d60 1
a60 1
        throws DataSetException, DoesNotExist
d62 2
a63 2
        return AccessControlledDatabaseFilter
            .filterProjects(acl, projects, "Project - View");
d66 3
a68 5
    public static List getContentViewableProjects(Connection connection,
                                                  DataManager dMgr,
                                                  AccessControlList acl, 
                                                  DataSet projects)
        throws DataSetException, DoesNotExist
d70 1
a70 23
        return AccessControlledDatabaseFilter
            .filterProjects(connection, dMgr, acl, projects, 
                            "Project Content - View");
    }
    
    public static List filterProjects(Connection connection, DataManager dMgr,
                                      AccessControlList acl, DataSet projects,
                                      String action)
        throws DataSetException, DoesNotExist
    {
        ArrayList accessibleProjects = new ArrayList();
        for (int i = 0; i < projects.size(); i++)
        {
            Record r = projects.getRecord(i);
            String projectID = 
                r.getValue(ProjectManager.PROJECT_ID).asString();
            if (acl.hasPermissionForProject(action, projectID))
            {
                accessibleProjects.add(new Project(connection, dMgr, r));
            }
        }       
        Collections.sort(accessibleProjects);
        return accessibleProjects;
d75 1
a75 1
        throws DataSetException, DoesNotExist
d78 9
a86 9
        for (Iterator i = projects.iterator(); i.hasNext();)
        {
            Project p = (Project)i.next();
            if (acl.hasPermissionForProject(action, p.getID()))
            {
                accessibleProjects.add(p);
            }
        }       
        Collections.sort(accessibleProjects);
@


1.10.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@@


1.10.2.2
log
@Re-adding.  Must still be ported.
@
text
@d52 1
d55 1
a55 3
import org.tigris.helm.*;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.*;
d57 6
a62 1
public class AccessControlledDatabaseFilter
d64 13
a76 2
    private static Log log = new Log("ACDF", "AccessControlledDatabaseFilter");
    private static final boolean DEBUG = true;
d78 1
a78 1
    public static List getViewableProjects(AccessControlList acl,
d80 1
a80 1
        throws DoesNotExist
d82 2
a83 2
        return filterProjects(acl, projects, "Project - View");
                            
d86 5
a90 3
    public static List getContentViewableProjects(AccessControlList acl, 
                                                  List projects)
        throws DoesNotExist
d92 23
a114 1
        return filterProjects(acl, projects, "Project Content - View");
d119 1
a119 1
        throws DoesNotExist
d122 9
a130 9
//         for (Iterator i = projects.iterator(); i.hasNext();)
//         {
//             Project p = (Project)i.next();
//             if (acl.hasPermissionForProject(action, p.getID()))
//             {
//                 accessibleProjects.add(p);
//             }
//         }       
//         Collections.sort(accessibleProjects);
@


1.10.2.3
log
@Removed unused logging.
@
text
@d52 2
d60 3
@


1.10.2.4
log
@Changed code to no longer use deprecated methods.
@
text
@d81 1
a81 1
//             if (acl.hasPermission(action, p.getID()))
@


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


1.9
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.8
log
@Added project group edit and delete.
@
text
@@


1.7
log
@Added method for stack's benefit.
@
text
@d78 8
d111 17
@


1.6
log
@Finished project pagination for ProjectList
@
text
@d77 11
@


1.5
log
@Started work on paginating ProjectList.
@
text
@a90 1
                log.info("Adding project " + projectID);
a91 2
            } else {
                log.info("Not adding project " + projectID);
@


1.4
log
@Sort projects by name whenever possible.
@
text
@d91 1
d93 2
@


1.3
log
@Fixed annoying bug that gave you permissions you didn't deserve.
@
text
@d94 1
d98 1
@


1.2
log
@Permission checking bugfixes; one more big one on the way.
@
text
@a90 1
                log.info("!!! User " + acl.getUserID() + " has " + action + " on project " + projectID);
@


1.1
log
@Initial revision
@
text
@d53 1
d64 2
d91 1
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d52 1
a52 3
import org.tigris.helm.*;
import org.tigris.helm.om.Project;
import org.tigris.helm.security.*;
d54 8
a61 1
public class AccessControlledDatabaseFilter
a62 7
    public static List getViewableProjects(AccessControlList acl,
                                           List projects)
        throws DoesNotExist
    {
        return filterProjects(acl, projects, "Project - View");
                            
    }
d64 5
a68 3
    public static List getContentViewableProjects(AccessControlList acl, 
                                                  List projects)
        throws DoesNotExist
d70 3
a72 1
        return filterProjects(acl, projects, "Project Content - View");
d74 3
a76 2

    public static List filterProjects(AccessControlList acl, List projects,
d78 1
a78 1
        throws DoesNotExist
d81 10
a90 9
//         for (Iterator i = projects.iterator(); i.hasNext();)
//         {
//             Project p = (Project)i.next();
//             if (acl.hasPermission(action, p.getID()))
//             {
//                 accessibleProjects.add(p);
//             }
//         }       
//         Collections.sort(accessibleProjects);
a93 1

@

