← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11149: Fix bug - The system administrator with the ALL authority get an empty list of programs.

 

------------------------------------------------------------
revno: 11149
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-06-06 10:56:54 +0700
message:
  Fix bug - The system administrator with the ALL authority get an empty list of programs.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java	2013-05-15 09:14:57 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java	2013-06-06 03:56:54 +0000
@@ -102,7 +102,8 @@
 
             for ( Program program : getAll() )
             {
-                if ( CollectionUtils.intersection( program.getUserRoles(), userRoles ).size() > 0 )
+                if ( userRoles.contains( UserAuthorityGroup.AUTHORITY_ALL )
+                    || CollectionUtils.intersection( program.getUserRoles(), userRoles ).size() > 0 )
                 {
                     programs.add( program );
                 }
@@ -127,7 +128,8 @@
 
             for ( Program program : getByType( type ) )
             {
-                if ( CollectionUtils.intersection( program.getUserRoles(), userRoles ).size() > 0 )
+                if ( userRoles.contains( UserAuthorityGroup.AUTHORITY_ALL )
+                    || CollectionUtils.intersection( program.getUserRoles(), userRoles ).size() > 0 )
                 {
                     programs.add( program );
                 }
@@ -146,13 +148,13 @@
     {
         Criteria criteria = getCriteria();
         criteria.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
-        
+
         if ( orgunit != null )
         {
             criteria.createAlias( "organisationUnits", "orgunit" );
             criteria.add( Restrictions.eq( "orgunit.id", orgunit.getId() ) );
         }
-        
+
         return criteria.list();
     }