Skip to content
Snippets Groups Projects
Commit 7b0aa1f3 authored by srosse's avatar srosse
Browse files

OO-4015: fix double conversion of user properties

parent a7201284
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,6 @@ import org.olat.basesecurity.IdentityPowerSearchQueries; ...@@ -38,7 +38,6 @@ import org.olat.basesecurity.IdentityPowerSearchQueries;
import org.olat.basesecurity.OrganisationRoles; import org.olat.basesecurity.OrganisationRoles;
import org.olat.basesecurity.SearchIdentityParams; import org.olat.basesecurity.SearchIdentityParams;
import org.olat.basesecurity.model.IdentityPropertiesRow; import org.olat.basesecurity.model.IdentityPropertiesRow;
import org.olat.basesecurity.model.QueryUserHelper;
import org.olat.core.commons.persistence.DB; import org.olat.core.commons.persistence.DB;
import org.olat.core.commons.persistence.QueryBuilder; import org.olat.core.commons.persistence.QueryBuilder;
import org.olat.core.commons.persistence.SortKey; import org.olat.core.commons.persistence.SortKey;
...@@ -112,7 +111,6 @@ public class IdentityPowerSearchQueriesImpl implements IdentityPowerSearchQuerie ...@@ -112,7 +111,6 @@ public class IdentityPowerSearchQueriesImpl implements IdentityPowerSearchQuerie
List<Object[]> rawList = dbq.getResultList(); List<Object[]> rawList = dbq.getResultList();
List<IdentityPropertiesRow> rows = new ArrayList<>(rawList.size()); List<IdentityPropertiesRow> rows = new ArrayList<>(rawList.size());
int numOfProperties = userPropertyHandlers.size(); int numOfProperties = userPropertyHandlers.size();
QueryUserHelper user = new QueryUserHelper();
for(Object[] rawObject:rawList) { for(Object[] rawObject:rawList) {
int pos = 0; int pos = 0;
...@@ -124,9 +122,7 @@ public class IdentityPowerSearchQueriesImpl implements IdentityPowerSearchQuerie ...@@ -124,9 +122,7 @@ public class IdentityPowerSearchQueriesImpl implements IdentityPowerSearchQuerie
String[] userProperties = new String[numOfProperties]; String[] userProperties = new String[numOfProperties];
for(int i=0; i<numOfProperties; i++) { for(int i=0; i<numOfProperties; i++) {
String userProperty = (String)rawObject[pos++]; userProperties[i] = (String)rawObject[pos++];
user.setUserProperty(userProperty);
userProperties[i] = userPropertyHandlers.get(i).getUserProperty(user, locale);
} }
rows.add(new IdentityPropertiesRow(identityKey, identityName, creationDate, lastLogin, status, userPropertyHandlers, userProperties, locale)); rows.add(new IdentityPropertiesRow(identityKey, identityName, creationDate, lastLogin, status, userPropertyHandlers, userProperties, locale));
......
...@@ -40,6 +40,14 @@ public class UserPropertiesRow { ...@@ -40,6 +40,14 @@ public class UserPropertiesRow {
private final String identityName; private final String identityName;
private final String[] identityProps; private final String[] identityProps;
/**
*
* @param identityKey The identity key
* @param identityName The identity name
* @param userPropertyHandlers The handlers (must match exactly the identities properties array)
* @param identityProps The raw user properties
* @param locale The locale
*/
public UserPropertiesRow(Long identityKey, String identityName, List<UserPropertyHandler> userPropertyHandlers, String[] identityProps, Locale locale) { public UserPropertiesRow(Long identityKey, String identityName, List<UserPropertyHandler> userPropertyHandlers, String[] identityProps, Locale locale) {
this.identityKey = identityKey; this.identityKey = identityKey;
this.identityName = identityName; this.identityName = identityName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment