← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14792: Event analytics, checking data view org unit access

 

------------------------------------------------------------
revno: 14792
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-04-11 09:58:35 +0200
message:
  Event analytics, checking data view org unit access
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryPlanner.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.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-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryPlanner.java	2014-03-24 22:19:59 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryPlanner.java	2014-04-11 07:58:35 +0000
@@ -30,6 +30,7 @@
 
 import java.util.List;
 
+import org.hisp.dhis.analytics.DataQueryParams;
 import org.hisp.dhis.common.IllegalQueryException;
 
 /**
@@ -48,6 +49,20 @@
      * @param params the query params.
      */
     List<EventQueryParams> planAggregateQuery( EventQueryParams params );
-    
+
+    /**
+     * Plans the given params and returns a list of params.
+     * 
+     * @param params the query params.
+     */
     EventQueryParams planEventQuery( EventQueryParams params );
+
+    /**
+     * Decides whether the current user has privileges to execute the given query.
+     * 
+     * @param params the data query params.
+     * @throws IllegalQueryException if the current user does not have privileges
+     *         to execute the given query.
+     */
+    void decideAccess( DataQueryParams params );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2014-04-10 23:45:13 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2014-04-11 07:58:35 +0000
@@ -128,6 +128,8 @@
 
     public Grid getAggregatedEventData( EventQueryParams params )
     {
+        queryPlanner.decideAccess( params );
+        
         queryPlanner.validate( params );
         
         Grid grid = new ListGrid();
@@ -192,6 +194,8 @@
 
     public Grid getEvents( EventQueryParams params )
     {
+        queryPlanner.decideAccess( params );
+        
         queryPlanner.validate( params );
 
         params.replacePeriodsWithStartEndDates();

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java	2014-04-10 21:12:18 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java	2014-04-11 07:58:35 +0000
@@ -168,6 +168,11 @@
         
         return params;
     }
+    
+    public void decideAccess( DataQueryParams params )
+    {
+        queryPlanner.decideAccess( params );
+    }
 
     // -------------------------------------------------------------------------
     // Supportive methods