← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13597: always set to public-read on interpretation object

 

------------------------------------------------------------
revno: 13597
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-01-06 20:04:09 +0100
message:
  always set to public-read on interpretation object
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AccessStringHelper.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.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/common/AccessStringHelper.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AccessStringHelper.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AccessStringHelper.java	2014-01-06 19:04:09 +0000
@@ -30,7 +30,7 @@
 
 /**
  * Currently only the two first positions in the access string are used - rw.
- * 
+ *
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public class AccessStringHelper
@@ -83,6 +83,11 @@
         return new AccessStringHelper();
     }
 
+    public static AccessStringHelper newInstance( char[] access )
+    {
+        return new AccessStringHelper( access );
+    }
+
     public AccessStringHelper enable( Permission permission )
     {
         access[permission.getPosition()] = permission.getValue();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2013-12-03 16:18:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2014-01-06 19:04:09 +0000
@@ -35,6 +35,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.common.AccessStringHelper;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
@@ -144,7 +145,7 @@
     {
         return user;
     }
-    
+
     @JsonProperty
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getType()
@@ -223,8 +224,7 @@
 
     public void updateSharing()
     {
-        setPublicAccess( getObject().getPublicAccess() );
-        setUserGroupAccesses( new HashSet<UserGroupAccess>( getObject().getUserGroupAccesses() ) );
+        setPublicAccess( AccessStringHelper.newInstance().enable( AccessStringHelper.Permission.READ ).build() );
     }
 
     // -------------------------------------------------------------------------