dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21510
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10193: removed old accessible methods. open up writing private report-tables to everyone (wip).
------------------------------------------------------------
revno: 10193
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 11:50:21 +0700
message:
removed old accessible methods. open up writing private report-tables to everyone (wip).
removed:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractAccessControlController.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2013-02-07 08:40:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2013-03-14 04:50:21 +0000
@@ -191,60 +191,4 @@
* @return list of objects.
*/
List<T> getByUser( User user );
-
- /**
- * Retrieves objects which are accessible to the given user, which includes
- * public objects and objects owned by this user.
- *
- * @param user the user.
- * @return a list of objects.
- */
- List<T> getAccessibleByUser( User user );
-
- /**
- * Retrieves objects which are accessible to the given user, which includes
- * public objects and objects owned by this user, that are equal to or newer
- * than given date.
- *
- * @param user the user.
- * @param lastUpdated the Date to compare with.
- * @return a list of objects.
- */
- List<T> getAccessibleByLastUpdated( User user, Date lastUpdated );
-
- /**
- * Retrieves objects which are accessible to the given user, which includes
- * public objects and objects owned by this user, which name is like the
- * given name.
- *
- * @param user the user.
- * @param name the name.
- * @return a list of objects.
- */
- List<T> getAccessibleLikeName( User user, String name );
-
- /**
- * Retrieves objects which are accessible to the given user, which includes
- * public objects and objects owned by this user, limited by the given offset
- * and max result.
- *
- * @param user the user.
- * @param first the first result object to return.
- * @param max the max number of result objects to return.
- * @return a list of objects.
- */
- List<T> getAccessibleBetween( User user, int first, int max );
-
- /**
- * Retrieves objects which are accessible to the given user, which includes
- * public objects and objects owned by this user, which name is like the
- * given name, limited by the given offset and max result.
- *
- * @param user the user.
- * @param name the name.
- * @param first the first result object to return.
- * @param max the max number of result objects to return.
- * @return a list of objects.
- */
- List<T> getAccessibleBetweenLikeName( User user, String name, int first, int max );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2012-12-13 12:48:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2013-03-14 04:50:21 +0000
@@ -82,14 +82,4 @@
IdentifiableObject getObject( int id, String simpleClassName );
<T extends IdentifiableObject> int getCount( Class<T> clazz );
-
- <T extends IdentifiableObject> List<T> getAllAccessible( Class<T> clazz );
-
- <T extends IdentifiableObject> List<T> getAccessibleLikeName( Class<T> clazz, String name );
-
- <T extends IdentifiableObject> List<T> getAccessibleBetween( Class<T> clazz, int first, int max );
-
- <T extends IdentifiableObject> List<T> getAccessibleBetweenLikeName( Class<T> clazz, String name, int first, int max );
-
- <T extends IdentifiableObject> List<T> getAccessibleByLastUpdated( Class<T> clazz, Date lastUpdated );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-11-07 07:06:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2013-03-14 04:50:21 +0000
@@ -132,7 +132,7 @@
Collection<Map> getSystemAndUserMaps();
- List<Map> getAccessibleMapsBetweenLikeName( String name, int first, int max );
+ List<Map> getMapsBetweenLikeName( String name, int first, int max );
// -------------------------------------------------------------------------
// MapView
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-03-01 10:18:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java 2013-03-14 04:50:21 +0000
@@ -32,7 +32,6 @@
import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty;
import org.hisp.dhis.common.NameableObject.NameableProperty;
import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -42,7 +41,6 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -481,88 +479,4 @@
return store;
}
-
- //--------------------------------------------------------------------------
- // Accessible
- //--------------------------------------------------------------------------
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IdentifiableObject> List<T> getAllAccessible( Class<T> clazz )
- {
- User user = currentUserService.getCurrentUser();
-
- GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
- if ( user == null || store == null )
- {
- return new ArrayList<T>();
- }
-
- return (List<T>) store.getAccessibleByUser( user );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IdentifiableObject> List<T> getAccessibleLikeName( Class<T> clazz, String name )
- {
- User user = currentUserService.getCurrentUser();
-
- GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
- if ( user == null || store == null )
- {
- return new ArrayList<T>();
- }
-
- return (List<T>) store.getAccessibleLikeName( user, name );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IdentifiableObject> List<T> getAccessibleBetween( Class<T> clazz, int first, int max )
- {
- User user = currentUserService.getCurrentUser();
-
- GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
- if ( user == null || store == null )
- {
- return new ArrayList<T>();
- }
-
- return (List<T>) store.getAccessibleBetween( user, first, max );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IdentifiableObject> List<T> getAccessibleBetweenLikeName( Class<T> clazz, String name, int first, int max )
- {
- User user = currentUserService.getCurrentUser();
-
- GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
- if ( user == null || store == null )
- {
- return new ArrayList<T>();
- }
-
- return (List<T>) store.getAccessibleBetweenLikeName( user, name, first, max );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends IdentifiableObject> List<T> getAccessibleByLastUpdated( Class<T> clazz, Date lastUpdated )
- {
- User user = currentUserService.getCurrentUser();
-
- GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
-
- if ( store == null )
- {
- return new ArrayList<T>();
- }
-
- return (List<T>) store.getAccessibleByLastUpdated( user, lastUpdated );
- }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2013-03-14 04:50:21 +0000
@@ -27,11 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
@@ -49,9 +44,13 @@
import org.hisp.dhis.system.util.ConversionUtils;
import org.hisp.dhis.system.util.MathUtils;
import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
/**
* @author Jan Henrik Overland
*/
@@ -64,7 +63,7 @@
// -------------------------------------------------------------------------
private MapStore mapStore;
-
+
public void setMapStore( MapStore mapStore )
{
this.mapStore = mapStore;
@@ -151,9 +150,9 @@
/**
* Returns the relevant OrganisationUnits for the given parent identifier
* and / or level.
- *
+ *
* @param parentOrganisationUnitId the OrganisationUnit level.
- * @param level the OrganisationUnit level.
+ * @param level the OrganisationUnit level.
* @return a collection of OrganisationUnits.
*/
private Collection<OrganisationUnit> getOrganisationUnits( Integer parentOrganisationUnitId, Integer level )
@@ -187,12 +186,12 @@
* and level must be specified. Period should be specified with "real time"
* aggregation strategy, any may be specified with "batch" aggregation
* strategy.
- *
- * @param indicatorId the Indicator identifier.
- * @param periodId the Period identifier. Ignored if null.
+ *
+ * @param indicatorId the Indicator identifier.
+ * @param periodId the Period identifier. Ignored if null.
* @param parentOrganisationUnitId the parent OrganisationUnit identifier.
- * Ignored if null.
- * @param level the OrganisationUnit level. Ignored if null.
+ * Ignored if null.
+ * @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId,
@@ -227,12 +226,12 @@
* and level must be specified. Period should be specified with "real time"
* aggregation strategy, any may be specified with "batch" aggregation
* strategy.
- *
- * @param dataElementId the DataElement identifier.
- * @param periodId the Period identifier. Ignored if null.
+ *
+ * @param dataElementId the DataElement identifier.
+ * @param periodId the Period identifier. Ignored if null.
* @param parentOrganisationUnitId the parent OrganisationUnit identifier.
- * Ignored if null.
- * @param level the OrganisationUnit level. Ignored if null.
+ * Ignored if null.
+ * @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
@@ -302,7 +301,7 @@
{
return mapLegendStore.save( mapLegend );
}
-
+
public void deleteMapLegend( MapLegend mapLegend )
{
mapLegendStore.delete( mapLegend );
@@ -400,41 +399,37 @@
{
return mapStore.save( map );
}
-
+
public void updateMap( Map map )
{
mapStore.update( map );
}
-
+
public Map getMap( int id )
{
return mapStore.get( id );
}
-
+
public Map getMap( String uid )
{
return mapStore.getByUid( uid );
}
-
+
public void deleteMap( Map map )
{
mapStore.delete( map );
}
-
+
public Collection<Map> getSystemAndUserMaps()
{
- User user = currentUserService.getCurrentUser();
-
- return mapStore.getAccessibleByUser( user );
+ return mapStore.getAll();
}
-
- public List<Map> getAccessibleMapsBetweenLikeName( String name, int first, int max )
+
+ public List<Map> getMapsBetweenLikeName( String name, int first, int max )
{
- User user = currentUserService.getCurrentUser();
-
- return mapStore.getAccessibleBetweenLikeName( user, name, first, max );
+ return mapStore.getAllLikeNameOrderedName( name, first, max );
}
-
+
// -------------------------------------------------------------------------
// MapView
// -------------------------------------------------------------------------
@@ -443,7 +438,7 @@
{
return mapViewStore.save( mapView );
}
-
+
public void updateMapView( MapView mapView )
{
mapViewStore.update( mapView );
@@ -515,7 +510,7 @@
for ( MapView mapView : mapViews )
{
//TODO poor performance, fix
-
+
if ( mapView.getParentOrganisationUnit() != null )
{
mapView.getParentOrganisationUnit().setLevel(
@@ -526,7 +521,7 @@
return mapViews;
}
-
+
public Collection<MapView> getMapViewsBetweenByName( String name, int first, int max )
{
return mapViewStore.getAllLikeNameOrderedName( name, first, max );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2012-11-06 07:01:56 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-03-14 04:50:21 +0000
@@ -125,7 +125,7 @@
objects.addAll( userService.getAllUsersBetweenByName( query, 0, MAX_PER_OBJECT ) );
objects.addAll( chartService.getChartsBetweenByName( query, 0, MAX_PER_OBJECT ) );
- objects.addAll( mappingService.getAccessibleMapsBetweenLikeName( query, 0, MAX_PER_OBJECT ) );
+ objects.addAll( mappingService.getMapsBetweenLikeName( query, 0, MAX_PER_OBJECT ) );
remaining = MAX_OBJECTS - objects.size();
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-03-13 10:01:17 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-03-14 04:50:21 +0000
@@ -34,7 +34,6 @@
import org.hibernate.SQLQuery;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.AccessStringHelper;
import org.hisp.dhis.common.AuditLogUtil;
@@ -185,7 +184,7 @@
* @param expressions the Criterions for the Criteria.
* @return an object of the implementation Class type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
protected final T getObject( Criterion... expressions )
{
return (T) getCriteria( expressions ).uniqueResult();
@@ -197,7 +196,7 @@
* @param expressions the Criterions for the Criteria.
* @return a List with objects of the implementation Class type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
protected final List<T> getList( Criterion... expressions )
{
return getCriteria( expressions ).list();
@@ -263,7 +262,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final T get( int id )
{
T object = (T) sessionFactory.getCurrentSession().get( getClazz(), id );
@@ -279,7 +278,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final T load( int id )
{
T object = (T) sessionFactory.getCurrentSession().load( getClazz(), id );
@@ -370,7 +369,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final List<T> getAll()
{
Query query = sharingEnabled() ? getQueryAllACL() : getQueryAll();
@@ -397,7 +396,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllEqName( String name )
{
Query query = sharingEnabled() ? getQueryAllEqNameACL( name ) : getQueryAllEqName( name );
@@ -429,7 +428,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllEqNameIgnoreCase( String name )
{
Query query = sharingEnabled() ? getQueryAllEqNameACLIgnoreCase( name ) : getQueryAllEqNameIgnoreCase( name );
@@ -461,7 +460,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllEqShortName( String shortName )
{
Query query = sharingEnabled() ? getQueryAllEqShortNameACL( shortName ) : getQueryAllEqShortName( shortName );
@@ -493,7 +492,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllEqShortNameIgnoreCase( String shortName )
{
Query query = sharingEnabled() ? getQueryAllEqShortNameACLIgnoreCase( shortName ) : getQueryAllEqShortNameIgnoreCase( shortName );
@@ -525,7 +524,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllLikeName( String name )
{
Query query = sharingEnabled() ? getQueryAllLikeNameACL( name ) : getQueryAllLikeName( name );
@@ -557,7 +556,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final List<T> getAllOrderedName()
{
Query query = sharingEnabled() ? getQueryAllOrderedNameACL() : getQueryAllOrderedName();
@@ -585,7 +584,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllOrderedName( int first, int max )
{
Query query = sharingEnabled() ? getQueryAllOrderedNameACL() : getQueryAllOrderedName();
@@ -597,7 +596,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllOrderedLastUpdated( int first, int max )
{
Query query = sharingEnabled() ? getQueryAllOrderedLastUpdatedACL() : getQueryAllOrderedLastUpdated();
@@ -628,7 +627,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllLikeNameOrderedName( String name, int first, int max )
{
Query query = sharingEnabled() ? getQueryAllLikeNameOrderedNameACL( name ) : getQueryAllLikeNameOrderedName( name );
@@ -751,7 +750,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllGeLastUpdated( Date lastUpdated )
{
Query query = sharingEnabled() ? getQueryAllGeLastUpdatedACL( lastUpdated ) : getQueryAllGeLastUpdated( lastUpdated );
@@ -783,7 +782,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllGeCreated( Date created )
{
Query query = sharingEnabled() ? getQueryAllGeCreatedACL( created ) : getQueryAllGeCreated( created );
@@ -815,7 +814,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getAllGeLastUpdatedOrderedName( Date lastUpdated )
{
Query query = sharingEnabled() ? getQueryAllGeLastUpdatedOrderedNameACL( lastUpdated ) : getQueryAllGeLastUpdatedOrderedName( lastUpdated );
@@ -847,7 +846,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public List<T> getByUser( User user )
{
Query query = getQuery( "from " + clazz.getName() + " c where user = :user" );
@@ -877,63 +876,6 @@
return list;
}
- @Override
- @SuppressWarnings("unchecked")
- public List<T> getAccessibleByUser( User user )
- {
- //TODO link to interface
-
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.or( Restrictions.eq( "user", user ), Restrictions.isNull( "user" ) ) );
- criteria.addOrder( Order.asc( "name" ) );
- return criteria.list();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<T> getAccessibleByLastUpdated( User user, Date lastUpdated )
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.or( Restrictions.eq( "user", user ), Restrictions.isNull( "user" ) ) );
- criteria.add( Restrictions.ge( "lastUpdated", lastUpdated ) );
- criteria.addOrder( Order.asc( "name" ) ).list();
- return criteria.list();
- }
-
- @SuppressWarnings("unchecked")
- public List<T> getAccessibleLikeName( User user, String name )
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) );
- criteria.add( Restrictions.or( Restrictions.eq( "user", user ), Restrictions.isNull( "user" ) ) );
- criteria.addOrder( Order.asc( "name" ) );
- return criteria.list();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<T> getAccessibleBetween( User user, int first, int max )
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.or( Restrictions.eq( "user", user ), Restrictions.isNull( "user" ) ) );
- criteria.addOrder( Order.asc( "name" ) );
- criteria.setFirstResult( first );
- criteria.setMaxResults( max );
- return criteria.list();
- }
-
- @SuppressWarnings("unchecked")
- public List<T> getAccessibleBetweenLikeName( User user, String name, int first, int max )
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.ilike( "name", "%" + name + "%" ) );
- criteria.add( Restrictions.or( Restrictions.eq( "user", user ), Restrictions.isNull( "user" ) ) );
- criteria.addOrder( Order.asc( "name" ) );
- criteria.setFirstResult( first );
- criteria.setMaxResults( max );
- return criteria.list();
- }
-
//----------------------------------------------------------------------------------------------------------------
// No ACL (unfiltered methods)
//----------------------------------------------------------------------------------------------------------------
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractAccessControlController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractAccessControlController.java 2012-10-26 17:22:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractAccessControlController.java 1970-01-01 00:00:00 +0000
@@ -1,92 +0,0 @@
-package org.hisp.dhis.api.controller;
-
-/*
- * Copyright (c) 2004-2012, 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.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.Pager;
-
-/**
- * @author Lars Helge Overland
- */
-public class AbstractAccessControlController<T extends IdentifiableObject>
- extends AbstractCrudController<T>
-{
- @Override
- protected List<T> getEntityList( WebMetaData metaData, WebOptions options )
- {
- List<T> entityList;
-
- Date lastUpdated = options.getLastUpdated();
-
- if ( lastUpdated != null )
- {
- entityList = new ArrayList<T>( manager.getAccessibleByLastUpdated( getEntityClass(), lastUpdated ) );
- }
- else if ( options.hasPaging() )
- {
- int count = manager.getCount( getEntityClass() );
-
- Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
- metaData.setPager( pager );
-
- entityList = new ArrayList<T>( manager.getAccessibleBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) );
- }
- else
- {
- entityList = new ArrayList<T>( manager.getAllAccessible( getEntityClass() ) );
- }
-
- return entityList;
- }
-
- @Override
- protected List<T> queryForEntityList( WebMetaData metaData, WebOptions options, String query )
- {
- List<T> entityList;
-
- if ( options.hasPaging() )
- {
- int count = manager.getCount( getEntityClass() );
-
- Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
- metaData.setPager( pager );
-
- entityList = new ArrayList<T>( manager.getAccessibleBetweenLikeName( getEntityClass(), query, pager.getOffset(), pager.getPageSize() ) );
- }
- else
- {
- entityList = new ArrayList<T>( manager.getAccessibleLikeName( getEntityClass(), query ) );
- }
-
- return entityList;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-03-13 15:03:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-03-14 04:50:21 +0000
@@ -27,15 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.period.PeriodType.getPeriodFromIsoString;
-
-import java.io.InputStream;
-import java.util.Iterator;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.hisp.dhis.api.controller.AbstractAccessControlController;
+import org.hisp.dhis.api.controller.AbstractCrudController;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
@@ -49,13 +41,19 @@
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
-import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import static org.hisp.dhis.period.PeriodType.getPeriodFromIsoString;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
* @author Lars Helge Overland
@@ -63,7 +61,7 @@
@Controller
@RequestMapping( value = MapController.RESOURCE_PATH )
public class MapController
- extends AbstractAccessControlController<Map>
+ extends AbstractCrudController<Map>
{
public static final String RESOURCE_PATH = "/maps";
@@ -72,22 +70,22 @@
@Autowired
private OrganisationUnitService organisationUnitService;
-
+
@Autowired
private OrganisationUnitGroupService organisationUnitGroupService;
-
+
@Autowired
private IndicatorService indicatorService;
-
+
@Autowired
private DataElementService dataElementService;
-
+
@Autowired
private PeriodService periodService;
-
+
@Autowired
private CurrentUserService currentUserService;
-
+
//--------------------------------------------------------------------------
// CRUD
//--------------------------------------------------------------------------
@@ -99,16 +97,16 @@
Map map = JacksonUtils.fromJson( input, Map.class );
mergeMap( map );
-
+
for ( MapView view : map.getMapViews() )
{
mergeMapView( view );
-
+
mappingService.addMapView( view );
}
mappingService.addMap( map );
-
+
ContextUtils.createdResponse( response, "Map created", RESOURCE_PATH + "/" + map.getUid() );
}
@@ -118,7 +116,7 @@
public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
{
Map map = mappingService.getMap( uid );
-
+
if ( map == null )
{
ContextUtils.notFoundResponse( response, "Map does not exist: " + uid );
@@ -126,14 +124,14 @@
}
Iterator<MapView> views = map.getMapViews().iterator();
-
+
while ( views.hasNext() )
{
MapView view = views.next();
views.remove();
mappingService.deleteMapView( view );
}
-
+
Map newMap = JacksonUtils.fromJson( input, Map.class );
mergeMap( newMap );
@@ -141,17 +139,17 @@
for ( MapView view : newMap.getMapViews() )
{
mergeMapView( view );
-
+
mappingService.addMapView( view );
}
map.mergeWith( newMap );
-
+
if ( newMap.getUser() == null )
{
map.setUser( null );
}
-
+
mappingService.updateMap( map );
}
@@ -161,7 +159,7 @@
public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception
{
Map map = mappingService.getMap( uid );
-
+
if ( map == null )
{
ContextUtils.notFoundResponse( response, "Map does not exist: " + uid );
@@ -169,17 +167,17 @@
}
Iterator<MapView> views = map.getMapViews().iterator();
-
+
while ( views.hasNext() )
{
MapView view = views.next();
views.remove();
mappingService.deleteMapView( view );
}
-
+
mappingService.deleteMap( map );
}
-
+
@Override
public void postProcessEntity( Map map )
{
@@ -199,57 +197,57 @@
//--------------------------------------------------------------------------
// TODO use the import service instead
-
+
private void mergeMap( Map map )
{
if ( map.getUser() != null )
{
map.setUser( currentUserService.getCurrentUser() );
- }
+ }
}
-
+
private void mergeMapView( MapView view )
{
if ( view.getIndicatorGroup() != null )
{
view.setIndicatorGroup( indicatorService.getIndicatorGroup( view.getIndicatorGroup().getUid() ) );
}
-
+
if ( view.getIndicator() != null )
{
view.setIndicator( indicatorService.getIndicator( view.getIndicator().getUid() ) );
}
-
+
if ( view.getDataElementGroup() != null )
{
view.setDataElementGroup( dataElementService.getDataElementGroup( view.getDataElementGroup().getUid() ) );
}
-
+
if ( view.getDataElement() != null )
{
view.setDataElement( dataElementService.getDataElement( view.getDataElement().getUid() ) );
}
-
+
if ( view.getPeriod() != null )
{
view.setPeriod( periodService.reloadPeriod( getPeriodFromIsoString( view.getPeriod().getUid() ) ) );
}
-
+
if ( view.getParentOrganisationUnit() != null )
{
view.setParentOrganisationUnit( organisationUnitService.getOrganisationUnit( view.getParentOrganisationUnit().getUid() ) );
}
-
+
if ( view.getOrganisationUnitLevel() != null )
{
view.setOrganisationUnitLevel( organisationUnitService.getOrganisationUnitLevel( view.getOrganisationUnitLevel().getUid() ) );
}
-
+
if ( view.getLegendSet() != null )
{
view.setLegendSet( mappingService.getMapLegendSet( view.getLegendSet().getUid() ) );
}
-
+
if ( view.getOrganisationUnitGroupSet() != null )
{
view.setOrganisationUnitGroupSet( organisationUnitGroupService.getOrganisationUnitGroupSet( view.getOrganisationUnitGroupSet().getUid() ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-03-13 15:03:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2013-03-14 04:50:21 +0000
@@ -126,7 +126,6 @@
F_REPORT_PRIVATE_ADD=Add Private Report
F_REPORT_DELETE=Delete Report
F_REPORTTABLE_PUBLIC_ADD=Add Public Report Table
-F_REPORTTABLE_PRIVATE_ADD=Add Private Report Table
F_REPORTTABLE_DELETE=Delete Report Table
F_REPORT_VIEW=View Report
F_CHART_ADD=Add Chart
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-01-25 15:24:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-03-14 04:50:21 +0000
@@ -151,7 +151,6 @@
<action name="saveTable" class="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction">
<result name="success" type="redirect">displayManageTableForm.action</result>
- <param name="anyAuthorities">F_REPORTTABLE_PUBLIC_ADD,F_REPORTTABLE_PRIVATE_ADD</param>
</action>
<action name="getReportParams" class="org.hisp.dhis.reporting.tablecreator.action.GetReportParamsAction">
@@ -166,7 +165,6 @@
<param name="page">/dhis-web-reporting/addTableForm.vm</param>
<param name="menu">/dhis-web-reporting/menu.vm</param>
<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/table.js,javascript/lists.js</param>
- <param name="anyAuthorities">F_REPORTTABLE_PUBLIC_ADD,F_REPORTTABLE_PRIVATE_ADD</param>
</action>
<action name="getTable" class="org.hisp.dhis.reporting.tablecreator.action.GetTableAction">