← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12227: Web api, using current user if no user set for analytical objects

 

------------------------------------------------------------
revno: 12227
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-24 11:43:55 +0200
message:
  Web api, using current user if no user set for analytical objects
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2013-09-24 09:43:55 +0000
@@ -68,6 +68,7 @@
 import org.hisp.dhis.period.RelativePeriodEnum;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.system.util.UniqueArrayList;
+import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -89,6 +90,9 @@
     @Autowired
     private PeriodService periodService;
     
+    @Autowired
+    private CurrentUserService currentUserService;
+    
     //--------------------------------------------------------------------------
     // DimensionService implementation
     //--------------------------------------------------------------------------
@@ -192,6 +196,10 @@
             {
                 object.setUser( identifiableObjectManager.get( User.class, object.getUser().getUid() ) );
             }
+            else
+            {
+                object.setUser( currentUserService.getCurrentUser() );
+            }
             
             mergeDimensionalObjects( object, object.getColumns() );
             mergeDimensionalObjects( object, object.getRows() );

=== 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-09-24 09:29:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2013-09-24 09:43:55 +0000
@@ -244,7 +244,11 @@
         if ( map.getUser() != null )
         {
             map.setUser( userService.getUser( map.getUser().getUid() ) );
-        }        
+        }
+        else
+        {
+            map.setUser( currentUserService.getCurrentUser() );
+        }
     }
 
     private void mergeMapView( MapView view )