dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34760
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17832: Users, proper sorting of items in edit user screen
------------------------------------------------------------
revno: 17832
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-12-29 19:17:39 +0100
message:
Users, proper sorting of items in edit user screen
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm
--
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/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2014-12-29 14:05:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2014-12-29 18:17:39 +0000
@@ -28,20 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.commons.lang.Validate;
import org.hisp.dhis.acl.Access;
import org.hisp.dhis.acl.AccessStringHelper;
import org.hisp.dhis.common.annotation.Description;
-import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.DimensionalView;
-import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.common.view.SharingBasicView;
import org.hisp.dhis.common.view.SharingDetailedView;
import org.hisp.dhis.common.view.SharingExportView;
@@ -51,12 +49,13 @@
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroupAccess;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Bob Jolliffe
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java 2014-12-29 18:17:39 +0000
@@ -29,7 +29,8 @@
*/
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
@@ -73,9 +74,9 @@
return user;
}
- private Collection<UserAuthorityGroup> userAuthorityGroups;
+ private List<UserAuthorityGroup> userAuthorityGroups;
- public Collection<UserAuthorityGroup> getUserAuthorityGroups()
+ public List<UserAuthorityGroup> getUserAuthorityGroups()
{
return userAuthorityGroups;
}
@@ -97,6 +98,8 @@
userAuthorityGroups.removeAll( user.getUserCredentials().getUserAuthorityGroups() );
}
+ Collections.sort( userAuthorityGroups );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2014-12-22 11:16:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2014-12-29 18:17:39 +0000
@@ -41,16 +41,16 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.i18n.I18nService;
import org.hisp.dhis.i18n.locale.LocaleManager;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.user.UserSettingService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -145,11 +145,18 @@
return userAuthorityGroups;
}
- private List<OrganisationUnitGroup> organisationUnitGroups;
+ private List<UserGroup> userGroups;
+
+ public List<UserGroup> getUserGroups()
+ {
+ return userGroups;
+ }
+
+ private List<DimensionalObject> dimensionConstraints;
- public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+ public List<DimensionalObject> getDimensionConstraints()
{
- return organisationUnitGroups;
+ return dimensionConstraints;
}
private List<Locale> availableLocales;
@@ -202,14 +209,6 @@
public String execute()
throws Exception
{
- userAuthorityGroups = new ArrayList<>( userService.getAllUserAuthorityGroups() );
-
- userService.canIssueFilter( userAuthorityGroups );
-
- availableLocales = localeManager.getAvailableLocales();
-
- availableLocalesDb = i18nService.getAvailableLocales();
-
if ( id != null )
{
user = userService.getUser( id );
@@ -232,10 +231,18 @@
selectionTreeManager.clearSelectedOrganisationUnits();
}
- userCredentials = userService.getUserCredentials( userService.getUser( id ) );
-
- userAuthorityGroups.removeAll( userCredentials.getUserAuthorityGroups() );
-
+ userCredentials = userService.getUserCredentials( user );
+
+ userAuthorityGroups = new ArrayList<>( userCredentials.getUserAuthorityGroups() );
+ userService.canIssueFilter( userAuthorityGroups );
+ Collections.sort( userAuthorityGroups );
+
+ userGroups = new ArrayList<>( user.getGroups() );
+ Collections.sort( userGroups );
+
+ dimensionConstraints = new ArrayList<>( userCredentials.getDimensionConstraints() );
+ Collections.sort( dimensionConstraints );
+
attributeValues = AttributeUtils.getAttributeValueMap( user.getAttributeValues() );
currentLocale = (Locale) userSettingService.getUserSettingValue( user, KEY_UI_LOCALE, LocaleManager.DHIS_STANDARD_LOCALE );
@@ -247,11 +254,13 @@
currentLocale = LocaleManager.DHIS_STANDARD_LOCALE;
}
- Collections.sort( userAuthorityGroups, IdentifiableObjectNameComparator.INSTANCE );
+ availableLocales = localeManager.getAvailableLocales();
+
+ availableLocalesDb = i18nService.getAvailableLocales();
attributes = new ArrayList<>( attributeService.getUserAttributes() );
Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2014-11-20 15:06:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2014-12-29 18:17:39 +0000
@@ -165,7 +165,7 @@
"required": true,
"i18n_available": "available_roles",
"i18n_selected": "selected_roles",
- "objects": $userCredentials.userAuthorityGroups
+ "objects": $userAuthorityGroups
})
<table style="margin-bottom: 20px;">
@@ -193,14 +193,14 @@
"prefix": "ug",
"i18n_available": "available_user_groups",
"i18n_selected": "selected_user_groups",
- "objects": $user.groups
+ "objects": $userGroups
})
#jqSelected({
"prefix": "dc",
"i18n_available": "available_dimension_restrictions_for_data_analytics",
"i18n_selected": "selected_dimension_restrictions_for_data_analytics",
- "objects": $userCredentials.dimensionConstraints
+ "objects": $dimensionConstraints
})
<div id="showFewerOptions" style="margin-bottom: 20px;"><a href="javascript:showUserOptions()">$i18n.getString( "show_fewer_options" )</a></div>