dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42932
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21856: bugfix for usergroup, search for users
------------------------------------------------------------
revno: 21856
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-03 09:48:50 +0700
message:
bugfix for usergroup, search for users
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js
--
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/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2016-02-02 06:34:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2016-02-03 02:48:50 +0000
@@ -44,6 +44,8 @@
import org.hisp.dhis.importexport.ImportStrategy;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.query.Order;
+import org.hisp.dhis.query.Query;
+import org.hisp.dhis.query.QueryParserException;
import org.hisp.dhis.schema.descriptors.UserSchemaDescriptor;
import org.hisp.dhis.security.RestoreOptions;
import org.hisp.dhis.security.SecurityService;
@@ -103,7 +105,7 @@
@Autowired
private OrganisationUnitService organisationUnitService;
-
+
@Autowired
private UserSettingService userSettingService;
@@ -112,7 +114,8 @@
// -------------------------------------------------------------------------
@Override
- protected List<User> getEntityList( WebMetadata metadata, WebOptions options, List<String> filters, List<Order> orders )
+ @SuppressWarnings( "unchecked" )
+ protected List<User> getEntityList( WebMetadata metadata, WebOptions options, List<String> filters, List<Order> orders ) throws QueryParserException
{
UserQueryParams params = new UserQueryParams();
params.setQuery( options.get( "query" ) );
@@ -148,7 +151,13 @@
params.setMax( pager.getPageSize() );
}
- return userService.getUsers( params );
+ List<User> users = userService.getUsers( params );
+
+ Query query = queryService.getQueryFromUrl( getEntityClass(), filters, orders );
+ query.setDefaultOrder();
+ query.setObjects( users );
+
+ return (List<User>) queryService.query( query );
}
@Override
@@ -356,17 +365,17 @@
// ---------------------------------------------------------------------
List<UserSetting> settings = userSettingService.getUserSettings( existingUser );
-
+
for ( UserSetting setting : settings )
{
Optional<UserSettingKey> key = UserSettingKey.getByName( setting.getName() );
-
+
if ( key.isPresent() )
{
userSettingService.saveUserSetting( key.get(), setting.getValue(), userReplica );
- }
+ }
}
-
+
response.addHeader( "Location", UserSchemaDescriptor.API_ENDPOINT + "/" + userReplica.getUid() );
webMessageService.send( WebMessageUtils.created( "User replica created" ), response, request );
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js 2016-01-13 08:24:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js 2016-02-03 02:48:50 +0000
@@ -173,7 +173,7 @@
};
if( context.like !== undefined && context.like.length > 0 ) {
- request.data.filter = 'name:like:' + context.like;
+ request.data.filter = 'displayName:ilike:' + context.like;
}
context.searchButton.find('i').removeClass('fa-search');