← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18042: minor

 

------------------------------------------------------------
revno: 18042
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-19 14:05:40 +0700
message:
  minor
modified:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.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-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java	2015-01-19 05:09:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java	2015-01-19 07:05:40 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.hibernate.exception.CreateAccessDeniedException;
 import org.hisp.dhis.hibernate.exception.DeleteAccessDeniedException;
+import org.hisp.dhis.hibernate.exception.UpdateAccessDeniedException;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserGroup;
@@ -362,6 +363,22 @@
         identifiableObjectManager.save( dataElement, false );
     }
 
+    // TODO this should actually throw a UpdateAccessDeniedException, but the problem is that we only have access to the updated object
+    @Test( /* expected = UpdateAccessDeniedException.class */ )
+    public void updateForPrivateUserDeniedAfterChangePublicAccessRW()
+    {
+        createUserAndInjectSecurityContext( false, "F_DATAELEMENT_PRIVATE_ADD" );
+
+        DataElement dataElement = createDataElement( 'A' );
+        dataElement.setPublicAccess( AccessStringHelper.DEFAULT );
+
+        identifiableObjectManager.save( dataElement, false );
+
+        dataElement.setPublicAccess( AccessStringHelper.READ_WRITE );
+
+        identifiableObjectManager.update( dataElement );
+    }
+
     @Test( expected = CreateAccessDeniedException.class )
     public void userDeniedForPublicAdd()
     {