dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33078
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16843: Org unit web tree, fixed bug. Making sure root org units become tree roots when user is null (e.g...
------------------------------------------------------------
revno: 16843
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-09-28 23:21:49 +0200
message:
Org unit web tree, fixed bug. Making sure root org units become tree roots when user is null (e.g. running single module)
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.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-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2014-09-28 20:14:48 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2014-09-28 21:21:49 +0000
@@ -192,27 +192,19 @@
return "partial";
}
- Collection<OrganisationUnit> userOrganisationUnits;
+ Collection<OrganisationUnit> userOrganisationUnits = new ArrayList<>();
User user = currentUserService.getCurrentUser();
- if ( user != null && user.getOrganisationUnits() != null && user.getOrganisationUnits().size() > 0 )
+ if ( user != null && user.hasOrganisationUnit() )
{
userOrganisationUnits = new ArrayList<>( user.getOrganisationUnits() );
rootOrganisationUnits = new ArrayList<>( user.getOrganisationUnits() );
}
- else
+ else if ( currentUserService.currentUserIsSuper() || user == null )
{
- if ( user != null && user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
- {
- userOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
- rootOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
- }
- else
- {
- userOrganisationUnits = new ArrayList<>();
- rootOrganisationUnits = new ArrayList<>();
- }
+ userOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
+ rootOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
}
if ( !versionOnly && !rootOrganisationUnits.isEmpty() )