← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21048: Sharing. Clearing hibenrate query cache on update of organisation unit group memberships. Hiberna...

 

------------------------------------------------------------
revno: 21048
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-13 14:55:20 +0100
message:
  Sharing. Clearing hibenrate query cache on update of organisation unit group memberships. Hibernate queries which includes sharing must be manually evicted to enfore that updates to user group memberships are reflected.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml


--
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/main/java/org/hisp/dhis/user/DefaultUserGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java	2015-07-14 07:21:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java	2015-11-13 13:55:20 +0000
@@ -33,6 +33,7 @@
 import java.util.List;
 
 import org.hisp.dhis.security.acl.AclService;
+import org.hisp.dhis.cache.HibernateCacheManager;
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -68,6 +69,13 @@
         this.aclService = aclService;
     }
     
+    private HibernateCacheManager cacheManager;
+
+    public void setCacheManager( HibernateCacheManager cacheManager )
+    {
+        this.cacheManager = cacheManager;
+    }
+
     // -------------------------------------------------------------------------
     // UserGroup
     // -------------------------------------------------------------------------
@@ -88,6 +96,10 @@
     public void updateUserGroup( UserGroup userGroup )
     {
         userGroupStore.update( userGroup );
+        
+        // Clear query cache due to sharing and user group membership
+        
+        cacheManager.clearQueryCache();
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-11-12 23:08:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-11-13 13:55:20 +0000
@@ -803,6 +803,7 @@
     <property name="userGroupStore" ref="org.hisp.dhis.user.UserGroupStore" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
     <property name="aclService" ref="org.hisp.dhis.security.acl.AclService" />
+    <property name="cacheManager" ref="cacheManager" />
   </bean>
 
   <bean id="org.hisp.dhis.user.UserGroupAccessService" class="org.hisp.dhis.user.DefaultUserGroupAccessService">