← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8840: Setting current user on map or null if system

 

------------------------------------------------------------
revno: 8840
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-11-03 17:18:46 +0300
message:
  Setting current user on map or null if system
modified:
  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-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	2012-10-31 14:33:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2012-11-03 14:18:46 +0000
@@ -46,7 +46,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.user.UserService;
+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;
@@ -77,9 +77,6 @@
     private OrganisationUnitGroupService organisationUnitGroupService;
     
     @Autowired
-    private UserService userService;
-    
-    @Autowired
     private IndicatorService indicatorService;
     
     @Autowired
@@ -88,6 +85,9 @@
     @Autowired
     private PeriodService periodService;
     
+    @Autowired
+    private CurrentUserService currentUserService;
+    
     //--------------------------------------------------------------------------
     // CRUD
     //--------------------------------------------------------------------------
@@ -147,6 +147,11 @@
 
         map.mergeWith( newMap );
         
+        if ( newMap.getUser() == null )
+        {
+            map.setUser( null );
+        }
+        
         mappingService.updateMap( map );
     }
     
@@ -199,7 +204,7 @@
     {
         if ( map.getUser() != null )
         {
-            map.setUser( userService.getUser( map.getUser().getUid() ) );
+            map.setUser( currentUserService.getCurrentUser() );
         }        
     }