← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22266: support setting passwords when updating users in dxf2 importer

 

------------------------------------------------------------
revno: 22266
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2016-03-13 11:55:03 +0700
message:
  support setting passwords when updating users in dxf2 importer
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/UserObjectBundleHook.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/UserObjectBundleHook.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/UserObjectBundleHook.java	2016-03-13 04:20:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/UserObjectBundleHook.java	2016-03-13 04:55:03 +0000
@@ -102,6 +102,12 @@
 
         User user = (User) identifiableObject;
         UserCredentials persistedUserCredentials = objectBundle.getPreheat().get( objectBundle.getPreheatIdentifier(), UserCredentials.class, user );
+
+        if ( !StringUtils.isEmpty( userCredentials.getPassword() ) )
+        {
+            userService.encodeAndSetPassword( userCredentials, userCredentials.getPassword() );
+        }
+
         persistedUserCredentials.mergeWith( userCredentials, objectBundle.getMergeMode() );
         preheatService.connectReferences( persistedUserCredentials, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );