← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14545: web-api: generate access info when including access property

 

------------------------------------------------------------
revno: 14545
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-31 12:05:20 +0700
message:
  web-api: generate access info when including access property
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.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-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2014-03-30 07:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2014-03-31 05:05:20 +0000
@@ -178,9 +178,12 @@
 
         ReflectionUtils.invokeSetterMethod( ExchangeClasses.getAllExportMap().get( getEntityClass() ), metaData, entityList );
 
-        String viewClass = options.getViewClass( "basic" );
+        if ( include.contains( "access" ) )
+        {
+            options.getOptions().put( "viewClass", "sharing" );
+        }
 
-        if ( viewClass.equals( "basic" ) )
+        if ( options.getViewClass( "basic" ).equals( "basic" ) )
         {
             handleLinksAndAccess( options, metaData, entityList, false );
         }
@@ -213,7 +216,7 @@
         }
         else
         {
-            renderService.toJson( response.getOutputStream(), metaData, JacksonUtils.getViewClass( viewClass ) );
+            renderService.toJson( response.getOutputStream(), metaData, JacksonUtils.getViewClass( options.getViewClass( "basic" ) ) );
         }
     }