← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17395: Approval, removed unused code

 

------------------------------------------------------------
revno: 17395
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-11-10 12:15:43 +0100
message:
  Approval, removed unused code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.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-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2014-11-10 11:08:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2014-11-10 11:15:43 +0000
@@ -204,21 +204,19 @@
      * (if the user is authorized for any) on this organisation unit.
      *
      * @param orgUnit org unit to test
-     * @param includeDataViewOrgUnits include data view org units in test?
      * @return approval level
      */
-    DataApprovalLevel getUserApprovalLevel( OrganisationUnit orgUnit, boolean includeDataViewOrgUnits );
+    DataApprovalLevel getUserApprovalLevel( OrganisationUnit orgUnit );
 
     /**
      * Gets the approval level at which this user may make approval actions
      * (if the user is authorized for any) on this organisation unit.
      *
      * @param orgUnit org unit to test
-     * @param includeDataViewOrgUnits include data view org units in test?
      * @param user user to get approval level from.
      * @return approval level
      */
-    DataApprovalLevel getUserApprovalLevel( User user, OrganisationUnit orgUnit, boolean includeDataViewOrgUnits );
+    DataApprovalLevel getUserApprovalLevel( User user, OrganisationUnit orgUnit );
 
     /**
      * By organisation unit subhierarchy, returns the lowest data approval

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java	2014-11-10 11:08:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java	2014-11-10 11:15:43 +0000
@@ -125,7 +125,7 @@
             return permissions; // No permissions are set.
         }
 
-        DataApprovalLevel userApprovalLevel = dataApprovalLevelService.getUserApprovalLevel( user, da.getOrganisationUnit(), false );
+        DataApprovalLevel userApprovalLevel = dataApprovalLevelService.getUserApprovalLevel( user, da.getOrganisationUnit() );
 
         if ( userApprovalLevel == null )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-11-10 11:08:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-11-10 11:15:43 +0000
@@ -466,15 +466,15 @@
     }
 
     @Override
-    public DataApprovalLevel getUserApprovalLevel( OrganisationUnit orgUnit, boolean includeDataViewOrgUnits )
+    public DataApprovalLevel getUserApprovalLevel( OrganisationUnit orgUnit )
     {
         User user = currentUserService.getCurrentUser();
         
-        return getUserApprovalLevel( user, orgUnit, includeDataViewOrgUnits );
+        return getUserApprovalLevel( user, orgUnit );
     }
     
     @Override
-    public DataApprovalLevel getUserApprovalLevel( User user, OrganisationUnit orgUnit, boolean includeDataViewOrgUnits )
+    public DataApprovalLevel getUserApprovalLevel( User user, OrganisationUnit orgUnit )
     {
         if ( user != null )
         {
@@ -485,17 +485,6 @@
                     return userApprovalLevel( ou, user );
                 }
             }
-
-            if ( includeDataViewOrgUnits && user.getDataViewOrganisationUnits() != null )
-            {
-                for ( OrganisationUnit ou : user.getDataViewOrganisationUnits() )
-                {
-                    if ( orgUnit.isEqualOrChildOf( org.hisp.dhis.system.util.CollectionUtils.asSet( ou ) ) )
-                    {
-                        return userApprovalLevel( ou, user );
-                    }
-                }
-            }
         }
 
         return null;