← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22259: more user fixes, properly handles usercredentials updates

 

------------------------------------------------------------
revno: 22259
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2016-03-12 15:52:42 +0700
message:
  more user fixes, properly handles usercredentials updates
added:
  dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/users_update.json
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java
  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/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.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-api/src/main/java/org/hisp/dhis/preheat/Preheat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-09 07:55:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-12 08:52:42 +0000
@@ -70,6 +70,12 @@
     }
 
     @SuppressWarnings( "unchecked" )
+    public <T extends IdentifiableObject> T get( PreheatIdentifier identifier, Class<? extends IdentifiableObject> klass, IdentifiableObject object )
+    {
+        return get( identifier, klass, identifier.getIdentifier( object ) );
+    }
+
+    @SuppressWarnings( "unchecked" )
     public <T extends IdentifiableObject> T get( PreheatIdentifier identifier, Class<? extends IdentifiableObject> klass, String key )
     {
         if ( !containsKey( identifier, klass, key ) )
@@ -152,6 +158,20 @@
             if ( !map.containsKey( PreheatIdentifier.UID ) ) map.put( PreheatIdentifier.UID, new HashMap<>() );
             if ( !map.get( PreheatIdentifier.UID ).containsKey( klass ) ) map.get( PreheatIdentifier.UID ).put( klass, new HashMap<>() );
 
+            if ( User.class.isAssignableFrom( klass ) )
+            {
+                if ( !map.get( PreheatIdentifier.UID ).containsKey( UserCredentials.class ) )
+                {
+                    map.get( PreheatIdentifier.UID ).put( UserCredentials.class, new HashMap<>() );
+                }
+
+                User user = (User) object;
+
+                Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.UID ).get( UserCredentials.class );
+                String key = PreheatIdentifier.UID.getIdentifier( user );
+                identifierMap.put( key, user.getUserCredentials() );
+            }
+
             Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.UID ).get( klass );
             String key = PreheatIdentifier.UID.getIdentifier( object );
             identifierMap.put( key, object );
@@ -162,6 +182,20 @@
             if ( !map.containsKey( PreheatIdentifier.CODE ) ) map.put( PreheatIdentifier.CODE, new HashMap<>() );
             if ( !map.get( PreheatIdentifier.CODE ).containsKey( klass ) ) map.get( PreheatIdentifier.CODE ).put( klass, new HashMap<>() );
 
+            if ( User.class.isAssignableFrom( klass ) )
+            {
+                if ( !map.get( PreheatIdentifier.CODE ).containsKey( UserCredentials.class ) )
+                {
+                    map.get( PreheatIdentifier.CODE ).put( UserCredentials.class, new HashMap<>() );
+                }
+
+                User user = (User) object;
+
+                Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.CODE ).get( UserCredentials.class );
+                String key = PreheatIdentifier.CODE.getIdentifier( user );
+                identifierMap.put( key, user.getUserCredentials() );
+            }
+
             Map<String, IdentifiableObject> identifierMap = map.get( PreheatIdentifier.CODE ).get( klass );
             String key = PreheatIdentifier.CODE.getIdentifier( object );
             identifierMap.put( key, object );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java	2016-03-03 05:02:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/PreheatIdentifier.java	2016-03-12 08:52:42 +0000
@@ -30,6 +30,7 @@
 
 import com.google.common.collect.Lists;
 import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.user.UserCredentials;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
@@ -55,9 +56,16 @@
      */
     AUTO;
 
-    @SuppressWarnings( "incomplete-switch" )
+    @SuppressWarnings( { "incomplete-switch", "unchecked" } )
     public <T extends IdentifiableObject> String getIdentifier( T object )
     {
+        object = UserCredentials.class.isInstance( object ) ? (T) ((UserCredentials) object).getUserInfo() : object;
+
+        if ( object == null )
+        {
+            return null;
+        }
+
         switch ( this )
         {
             case UID:

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java	2016-03-02 15:49:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java	2016-03-12 08:52:42 +0000
@@ -111,7 +111,7 @@
      */
     @Scanned
     private Set<OrganisationUnit> dataViewOrganisationUnits = new HashSet<>();
-    
+
     /**
      * Organisation units for tracked entity instance search operations.
      */
@@ -211,7 +211,7 @@
     // -------------------------------------------------------------------------
     // Logic - data view organisation unit
     // -------------------------------------------------------------------------
-    
+
     public boolean hasDataViewOrganisationUnit()
     {
         return !CollectionUtils.isEmpty( dataViewOrganisationUnits );
@@ -244,11 +244,11 @@
     {
         return hasDataViewOrganisationUnit() ? dataViewOrganisationUnits : organisationUnits;
     }
-    
+
     // -------------------------------------------------------------------------
     // Logic - tei search organisation unit
     // -------------------------------------------------------------------------
-    
+
     public boolean hasTeiSearchOrganisationUnit()
     {
         return !CollectionUtils.isEmpty( teiSearchOrganisationUnits );
@@ -281,7 +281,7 @@
     {
         return hasTeiSearchOrganisationUnit() ? teiSearchOrganisationUnits : organisationUnits;
     }
-    
+
 
     public String getOrganisationUnitsName()
     {
@@ -657,7 +657,7 @@
     public void setDataViewOrganisationUnits( Set<OrganisationUnit> dataViewOrganisationUnits )
     {
         this.dataViewOrganisationUnits = dataViewOrganisationUnits;
-    }   
+    }
 
     @JsonProperty
     @JsonSerialize( contentAs = BaseIdentifiableObject.class )
@@ -735,7 +735,7 @@
 
             dataViewOrganisationUnits.clear();
             dataViewOrganisationUnits.addAll( user.getDataViewOrganisationUnits() );
-            
+
             teiSearchOrganisationUnits.clear();
             teiSearchOrganisationUnits.addAll( user.getTeiSearchOrganisationUnits() );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-03-12 07:09:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/DefaultObjectBundleService.java	2016-03-12 08:52:42 +0000
@@ -312,6 +312,8 @@
                     break;
                 }
             }
+
+            session.flush();
         }
 
         objectBundleHooks.forEach( hook -> hook.postImport( bundle ) );
@@ -351,8 +353,6 @@
 
             if ( FlushMode.OBJECT == bundle.getFlushMode() ) session.flush();
         }
-
-        if ( FlushMode.OBJECTS == bundle.getFlushMode() ) session.flush();
     }
 
     private void handleUpdates( Session session, List<IdentifiableObject> objects, ObjectBundle bundle )
@@ -376,6 +376,8 @@
 
             objectBundleHooks.forEach( hook -> hook.postUpdate( persistedObject, bundle ) );
 
+            bundle.getPreheat().put( bundle.getPreheatIdentifier(), persistedObject );
+
             if ( log.isDebugEnabled() )
             {
                 String msg = "Updated object '" + bundle.getPreheatIdentifier().getIdentifiersWithName( persistedObject ) + "'";
@@ -384,8 +386,6 @@
 
             if ( FlushMode.OBJECT == bundle.getFlushMode() ) session.flush();
         }
-
-        if ( FlushMode.OBJECTS == bundle.getFlushMode() ) session.flush();
     }
 
     private void handleDeletes( Session session, List<IdentifiableObject> objects, ObjectBundle bundle )
@@ -409,8 +409,6 @@
 
             if ( FlushMode.OBJECT == bundle.getFlushMode() ) session.flush();
         }
-
-        if ( FlushMode.OBJECTS == bundle.getFlushMode() ) session.flush();
     }
 
     @SuppressWarnings( "unchecked" )

=== 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-12 07:09:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/UserObjectBundleHook.java	2016-03-12 08:52:42 +0000
@@ -66,6 +66,14 @@
         {
             // Username exists, throw validation error
         }
+    }
+
+    @Override
+    public void postCreate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
+    {
+        if ( !User.class.isInstance( identifiableObject ) || userCredentials == null ) return;
+
+        User user = (User) identifiableObject;
 
         if ( !StringUtils.isEmpty( userCredentials.getPassword() ) )
         {
@@ -73,19 +81,34 @@
         }
 
         preheatService.connectReferences( userCredentials, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
-    }
-
-    @Override
-    public void postCreate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
-    {
-        if ( !User.class.isInstance( identifiableObject ) || userCredentials == null ) return;
-
-        User user = (User) identifiableObject;
-        userCredentials.setUserInfo( user );
         sessionFactory.getCurrentSession().save( userCredentials );
         user.setUserCredentials( userCredentials );
-        sessionFactory.getCurrentSession().update( userCredentials );
-
+        sessionFactory.getCurrentSession().update( user );
+        userCredentials = null;
+    }
+
+    @Override
+    public void preUpdate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
+    {
+        if ( !User.class.isInstance( identifiableObject ) || ((User) identifiableObject).getUserCredentials() == null ) return;
+        User user = (User) identifiableObject;
+        userCredentials = user.getUserCredentials();
+    }
+
+    @Override
+    public void postUpdate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
+    {
+        if ( !User.class.isInstance( identifiableObject ) || userCredentials == null ) return;
+
+        User user = (User) identifiableObject;
+        UserCredentials persistedUserCredentials = objectBundle.getPreheat().get( objectBundle.getPreheatIdentifier(), UserCredentials.class, user );
+        persistedUserCredentials.mergeWith( userCredentials, objectBundle.getMergeMode() );
+        preheatService.connectReferences( persistedUserCredentials, objectBundle.getPreheat(), objectBundle.getPreheatIdentifier() );
+
+        persistedUserCredentials.setUserInfo( user );
+        user.setUserCredentials( persistedUserCredentials );
+
+        sessionFactory.getCurrentSession().update( user.getUserCredentials() );
         userCredentials = null;
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java	2016-03-12 06:45:56 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java	2016-03-12 08:52:42 +0000
@@ -1143,6 +1143,58 @@
         assertEquals( "admin", userB.getUserCredentials().getUser().getUserCredentials().getUsername() );
     }
 
+    @Test
+    public void testUpdateUsers() throws IOException
+    {
+        Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(
+            new ClassPathResource( "dxf2/users.json" ).getInputStream(), RenderFormat.JSON );
+
+        ObjectBundleParams params = new ObjectBundleParams();
+        params.setObjectBundleMode( ObjectBundleMode.COMMIT );
+        params.setImportMode( ImportStrategy.CREATE );
+        params.setObjects( metadata );
+
+        ObjectBundle bundle = objectBundleService.create( params );
+        ObjectBundleValidation validate = objectBundleService.validate( bundle );
+        assertTrue( validate.getObjectErrorReports().isEmpty() );
+        objectBundleService.commit( bundle );
+
+        metadata = renderService.fromMetadata( new ClassPathResource( "dxf2/users_update.json" ).getInputStream(), RenderFormat.JSON );
+
+        params = new ObjectBundleParams();
+        params.setObjectBundleMode( ObjectBundleMode.COMMIT );
+        params.setImportMode( ImportStrategy.UPDATE );
+        params.setObjects( metadata );
+
+        bundle = objectBundleService.create( params );
+        validate = objectBundleService.validate( bundle );
+        assertTrue( validate.getObjectErrorReports().isEmpty() );
+        objectBundleService.commit( bundle );
+
+        List<User> users = manager.getAll( User.class );
+        assertEquals( 3, users.size() );
+
+        User userA = manager.get( User.class, "sPWjoHSY03y" );
+        User userB = manager.get( User.class, "MwhEJUnTHkn" );
+
+        assertNotNull( userA );
+        assertNotNull( userB );
+
+        assertNotNull( userA.getUserCredentials().getUserInfo() );
+        assertNotNull( userB.getUserCredentials().getUserInfo() );
+        assertNotNull( userA.getUserCredentials().getUserInfo().getUserCredentials() );
+        assertNotNull( userB.getUserCredentials().getUserInfo().getUserCredentials() );
+        assertEquals( "UserAA", userA.getUserCredentials().getUserInfo().getUserCredentials().getUsername() );
+        assertEquals( "UserBB", userB.getUserCredentials().getUserInfo().getUserCredentials().getUsername() );
+
+        assertNotNull( userA.getUserCredentials().getUser() );
+        assertNotNull( userB.getUserCredentials().getUser() );
+        assertNotNull( userA.getUserCredentials().getUser().getUserCredentials() );
+        assertNotNull( userB.getUserCredentials().getUser().getUserCredentials() );
+        assertEquals( "admin", userA.getUserCredentials().getUser().getUserCredentials().getUsername() );
+        assertEquals( "admin", userB.getUserCredentials().getUser().getUserCredentials().getUsername() );
+    }
+
     private void defaultSetup()
     {
         DataElement de1 = createDataElement( 'A' );

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/users_update.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/users_update.json	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/users_update.json	2016-03-12 08:52:42 +0000
@@ -0,0 +1,267 @@
+{
+  "categoryCombos": [
+    {
+      "publicAccess": "--------",
+      "name": "default",
+      "lastUpdated": "2016-03-12T06:18:23.544+0000",
+      "created": "2016-03-12T06:18:23.542+0000",
+      "skipTotal": false,
+      "categories": [
+        {
+          "id": "xO3nVNouT8B"
+        }
+      ],
+      "id": "frKSiFeYBD2",
+      "userGroupAccesses": [ ]
+    }
+  ],
+  "userRoles": [
+    {
+      "dataSets": [ ],
+      "publicAccess": "--------",
+      "name": "Superuser",
+      "programs": [ ],
+      "lastUpdated": "2016-03-12T06:18:41.386+0000",
+      "created": "2016-03-12T06:18:41.386+0000",
+      "userGroupAccesses": [ ],
+      "authorities": [
+        "F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS",
+        "ALL",
+        "F_USERGROUP_MANAGING_RELATIONSHIPS_ADD",
+        "F_REPORTTABLE_PUBLIC_ADD",
+        "F_TRACKED_ENTITY_INSTANCE_DELETE",
+        "F_USER_GROUPS_READ_ONLY_ADD_MEMBERS",
+        "F_MAP_PUBLIC_ADD",
+        "F_USER_ADD_WITHIN_MANAGED_GROUP",
+        "F_TRACKED_ENTITY_INSTANCE_SEARCH",
+        "F_PROGRAM_ENROLLMENT",
+        "F_REPORTTABLE_EXTERNAL",
+        "F_SQLVIEW_EXTERNAL",
+        "F_GIS_ADMIN",
+        "F_REPLICATE_USER",
+        "F_INSERT_CUSTOM_JS_CSS",
+        "F_DASHBOARD_PUBLIC_ADD",
+        "F_METADATA_IMPORT",
+        "F_CHART_PUBLIC_ADD",
+        "F_VIEW_UNAPPROVED_DATA",
+        "F_CHART_EXTERNAL",
+        "F_USERGROUP_MANAGING_RELATIONSHIPS_VIEW",
+        "F_METADATA_EXPORT",
+        "F_PROGRAM_UNENROLLMENT",
+        "F_APPROVE_DATA",
+        "F_ACCEPT_DATA_LOWER_LEVELS",
+        "F_TRACKED_ENTITY_INSTANCE_ADD",
+        "F_USERGROUP_PUBLIC_ADD",
+        "F_OAUTH2_CLIENT_MANAGE",
+        "F_TRACKED_ENTITY_DATAVALUE_ADD",
+        "F_PROGRAM_DASHBOARD_CONFIG_ADMIN",
+        "F_MAP_EXTERNAL",
+        "F_APPROVE_DATA_LOWER_LEVELS",
+        "F_TRACKED_ENTITY_DATAVALUE_DELETE"
+      ],
+      "id": "tHEWGwIMsJk"
+    }
+  ],
+  "categoryOptions": [
+    {
+      "name": "default",
+      "publicAccess": "--------",
+      "userGroupAccesses": [ ],
+      "attributeValues": [ ],
+      "id": "l9KXrytvyib",
+      "organisationUnits": [ ],
+      "created": "2016-03-12T06:18:23.528+0000",
+      "lastUpdated": "2016-03-12T06:18:23.546+0000"
+    }
+  ],
+  "date": "2016-03-12T06:21:34.667+0000",
+  "categoryOptionCombos": [
+    {
+      "name": "default",
+      "created": "2016-03-12T06:18:23.543+0000",
+      "lastUpdated": "2016-03-12T06:18:23.543+0000",
+      "categoryCombo": {
+        "id": "frKSiFeYBD2"
+      },
+      "categoryOptions": [
+        {
+          "id": "l9KXrytvyib"
+        }
+      ],
+      "ignoreApproval": false,
+      "id": "gf1lAXwR7G5"
+    }
+  ],
+  "organisationUnits": [
+    {
+      "path": "/inVD5SdytkT",
+      "openingDate": "2016-03-11T17:00:00.000+0000",
+      "lastUpdated": "2016-03-12T06:19:49.665+0000",
+      "created": "2016-03-12T06:19:49.649+0000",
+      "shortName": "Country",
+      "user": {
+        "id": "enHApD3I6Ho"
+      },
+      "attributeValues": [ ],
+      "id": "inVD5SdytkT",
+      "name": "Country",
+      "description": "",
+      "featureType": "NONE",
+      "uuid": "0f2d7a85-3b6e-4cae-9d5a-e2903331629b"
+    }
+  ],
+  "trackedEntities": [
+    {
+      "id": "xjZaLLspj2r",
+      "attributeValues": [ ],
+      "description": "Person",
+      "name": "Person"
+    }
+  ],
+  "categories": [
+    {
+      "id": "xO3nVNouT8B",
+      "userGroupAccesses": [ ],
+      "dataDimension": true,
+      "lastUpdated": "2016-03-12T06:18:23.683+0000",
+      "created": "2016-03-12T06:18:23.540+0000",
+      "categoryOptions": [
+        {
+          "id": "l9KXrytvyib"
+        }
+      ],
+      "publicAccess": "--------",
+      "name": "default"
+    }
+  ],
+  "users": [
+    {
+      "email": "user@xxxxx",
+      "surname": "BB",
+      "firstName": "User",
+      "created": "2016-03-12T06:21:02.324+0000",
+      "lastUpdated": "2016-03-12T06:21:02.325+0000",
+      "dataViewOrganisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "organisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "userCredentials": {
+        "user": {
+          "id": "enHApD3I6Ho"
+        },
+        "cogsDimensionConstraints": [ ],
+        "selfRegistered": false,
+        "catDimensionConstraints": [ ],
+        "lastLogin": "2016-03-12T06:21:02.226+0000",
+        "created": "2016-03-12T06:21:02.329+0000",
+        "passwordLastUpdated": "2016-03-12T06:21:02.226+0000",
+        "userInfo": {
+          "id": "MwhEJUnTHkn"
+        },
+        "userRoles": [
+          {
+            "id": "tHEWGwIMsJk"
+          }
+        ],
+        "username": "UserBB",
+        "invitation": false,
+        "disabled": false,
+        "externalAuth": false
+      },
+      "teiSearchOrganisationUnits": [ ],
+      "id": "MwhEJUnTHkn",
+      "attributeValues": [ ]
+    },
+    {
+      "firstName": "User",
+      "email": "user@xxxxx",
+      "surname": "AA",
+      "attributeValues": [ ],
+      "id": "sPWjoHSY03y",
+      "created": "2016-03-12T06:20:43.502+0000",
+      "lastUpdated": "2016-03-12T06:20:43.502+0000",
+      "dataViewOrganisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "organisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "userCredentials": {
+        "username": "UserAA",
+        "userRoles": [
+          {
+            "id": "tHEWGwIMsJk"
+          }
+        ],
+        "invitation": false,
+        "disabled": false,
+        "externalAuth": false,
+        "cogsDimensionConstraints": [ ],
+        "user": {
+          "id": "enHApD3I6Ho"
+        },
+        "selfRegistered": false,
+        "catDimensionConstraints": [ ],
+        "lastLogin": "2016-03-12T06:20:43.407+0000",
+        "created": "2016-03-12T06:20:43.508+0000",
+        "userInfo": {
+          "id": "sPWjoHSY03y"
+        },
+        "passwordLastUpdated": "2016-03-12T06:20:43.407+0000"
+      },
+      "teiSearchOrganisationUnits": [ ]
+    },
+    {
+      "surname": "admin",
+      "firstName": "admin",
+      "organisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "dataViewOrganisationUnits": [
+        {
+          "id": "inVD5SdytkT"
+        }
+      ],
+      "userCredentials": {
+        "externalAuth": false,
+        "disabled": false,
+        "invitation": false,
+        "userRoles": [
+          {
+            "id": "tHEWGwIMsJk"
+          }
+        ],
+        "username": "admin",
+        "passwordLastUpdated": "2016-03-12T06:18:41.403+0000",
+        "userInfo": {
+          "id": "enHApD3I6Ho"
+        },
+        "created": "2016-03-12T06:18:41.505+0000",
+        "lastLogin": "2016-03-12T06:18:41.401+0000",
+        "catDimensionConstraints": [ ],
+        "selfRegistered": false,
+        "user": {
+          "id": "enHApD3I6Ho"
+        },
+        "cogsDimensionConstraints": [ ]
+      },
+      "lastUpdated": "2016-03-12T06:20:18.336+0000",
+      "created": "2016-03-12T06:18:41.374+0000",
+      "teiSearchOrganisationUnits": [ ],
+      "id": "enHApD3I6Ho",
+      "attributeValues": [ ]
+    }
+  ]
+}