← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1556: Removed unused authority provider

 

------------------------------------------------------------
revno: 1556
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-04 21:55:18 +0100
message:
  Removed unused authority provider
removed:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/authority/FileSystemAuthoritiesProvider.java
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/authority/FileSystemAuthoritiesProvider.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/authority/FileSystemAuthoritiesProvider.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/authority/FileSystemAuthoritiesProvider.java	1970-01-01 00:00:00 +0000
@@ -1,128 +0,0 @@
-package org.hisp.dhis.security.authority;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: FileSystemAuthoritiesProvider.java 3160 2007-03-24 20:15:06Z torgeilo $
- */
-public class FileSystemAuthoritiesProvider
-    implements SystemAuthoritiesProvider
-{
-    private static final Log LOG = LogFactory.getLog( FileSystemAuthoritiesProvider.class );
-
-    // -------------------------------------------------------------------------
-    // Configuration
-    // -------------------------------------------------------------------------
-
-    private String authoritiesFilePath;
-
-    public void setAuthoritiesFilePath( String authoritiesFilePath )
-    {
-        this.authoritiesFilePath = authoritiesFilePath;
-    }
-
-    // -------------------------------------------------------------------------
-    // Load authorities from all files matching authoritiesFilePath.
-    // -------------------------------------------------------------------------
-
-    public Collection<String> loadAuthorities()
-        throws IOException
-    {
-        if ( authoritiesFilePath == null )
-        {
-            throw new IllegalStateException( "Authorities file path not specified" );
-        }
-
-        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-        Enumeration<URL> resources = classLoader.getResources( authoritiesFilePath );
-
-        if ( !resources.hasMoreElements() )
-        {
-            LOG.warn( "No resources found for path: '" + authoritiesFilePath + "'" );
-
-            return Collections.emptySet();
-        }
-
-        HashSet<String> systemAuthorities = new HashSet<String>();
-
-        while ( resources.hasMoreElements() )
-        {
-            InputStream in = resources.nextElement().openStream();
-            BufferedReader reader = new BufferedReader( new InputStreamReader( in ) );
-
-            String line;
-
-            while ( (line = reader.readLine()) != null )
-            {
-                line = line.trim();
-
-                if ( line.length() > 0 )
-                {
-                    systemAuthorities.add( line );
-                }
-            }
-
-            reader.close();
-            in.close();
-        }
-
-        return systemAuthorities;
-    }
-
-    // -------------------------------------------------------------------------
-    // SystemAuthoritiesProvider implementation
-    // -------------------------------------------------------------------------
-
-    public Collection<String> getSystemAuthorities()
-    {
-        try
-        {
-            return loadAuthorities();
-        }
-        catch ( IOException e )
-        {
-            LOG.error( "Failed to load authorities files", e );
-        }
-
-        return Collections.emptySet();
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2010-03-04 16:57:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2010-03-04 20:55:18 +0000
@@ -259,7 +259,7 @@
 		</property>
 	</bean>
 
-	<!-- Security -->
+	<!-- Security : Action -->
 
 	<bean id="org.hisp.dhis.security.action.LoggedInAction" class="org.hisp.dhis.security.action.LoggedInAction"
 		scope="prototype">
@@ -270,6 +270,8 @@
 			ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
 	</bean>
 	
+    <!-- Security : Filter -->
+	
 	<bean id="httpSessionContextIntegrationFilter"
 		class="org.springframework.security.context.HttpSessionContextIntegrationFilter" />
 
@@ -305,6 +307,13 @@
 		</property>
 	</bean>
 
+    <bean id="requiredLoginFilter" class="org.hisp.dhis.security.filter.RequiredLoginFilter">
+        <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+        <property name="loginPageUrl" value="/dhis-web-commons/security/login.html" />
+    </bean>
+
+    <!-- Security : AccessProvider -->
+    
 	<bean id="databaseAutomaticAccessProvider" class="org.hisp.dhis.security.DatabaseAutomaticAccessProvider">
 		<property name="userStore" ref="org.hisp.dhis.user.UserStore" />
 		<property name="systemAuthoritiesProvider"
@@ -318,11 +327,8 @@
 			ref="org.hisp.dhis.security.authority.SystemAuthoritiesProvider" />
 	</bean>
 
-	<bean id="requiredLoginFilter" class="org.hisp.dhis.security.filter.RequiredLoginFilter">
-		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="loginPageUrl" value="/dhis-web-commons/security/login.html" />
-	</bean>
-
+    <!-- Security : AccessDecion/Voter -->
+    
 	<bean id="accessDecisionManager"
 		class="org.hisp.dhis.security.vote.LogicalOrAccessDecisionManager">
 		<property name="accessDecisionManagers">
@@ -376,6 +382,14 @@
 		<property name="requiredAuthority" value="ALL" />
 	</bean>
 
+    <bean id="org.hisp.dhis.security.ActionAccessResolver" class="org.hisp.dhis.security.SpringSecurityActionAccessResolver">
+        <property name="requiredAuthoritiesProvider"
+            ref="org.hisp.dhis.security.authority.RequiredAuthoritiesProvider" />
+        <property name="accessDecisionManager" ref="accessDecisionManager" />
+    </bean>
+
+    <!-- Security : Interceptor -->
+    
 	<bean id="org.hisp.dhis.security.intercept.XWorkSecurityInterceptor"
 		class="org.hisp.dhis.security.intercept.XWorkSecurityInterceptor">
 		<property name="accessDecisionManager" ref="accessDecisionManager" />
@@ -386,19 +400,14 @@
 		<property name="actionAccessResolver" ref="org.hisp.dhis.security.ActionAccessResolver" />
 	</bean>
 
-	<bean id="org.hisp.dhis.security.ActionAccessResolver" class="org.hisp.dhis.security.SpringSecurityActionAccessResolver">
-		<property name="requiredAuthoritiesProvider"
-			ref="org.hisp.dhis.security.authority.RequiredAuthoritiesProvider" />
-		<property name="accessDecisionManager" ref="accessDecisionManager" />
-	</bean>
-
+    <!-- Security : AuthorityProvider -->
+    
 	<bean id="org.hisp.dhis.security.authority.RequiredAuthoritiesProvider"
 		class="org.hisp.dhis.security.authority.DefaultRequiredAuthoritiesProvider">
 		<property name="requiredAuthoritiesKey" value="requiredAuthorities" />
 		<property name="globalAttributes">
 			<set>
-				<value>M_MODULE_ACCESS_VOTER_ENABLED
-				</value>
+				<value>M_MODULE_ACCESS_VOTER_ENABLED</value>
 			</set>
 		</property>
 	</bean>