=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java' --- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2014-09-15 14:37:25 +0000 +++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2014-09-16 05:20:02 +0000 @@ -191,7 +191,7 @@ { Criteria criteria = sessionFactory.getCurrentSession().createCriteria( getClazz(), "c" ).setCacheable( cacheable ); - if ( !sharingEnabled() ) + if ( !sharingEnabled() || user == null ) { return criteria; } @@ -253,7 +253,7 @@ * @param expressions the Criterions for the Criteria. * @return an object of the implementation Class type. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected final T getObject( Criterion... expressions ) { return (T) getCriteria( expressions ).uniqueResult(); @@ -265,7 +265,7 @@ * @param expressions the Criterions for the Criteria. * @return a List with objects of the implementation Class type. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected final List getList( Criterion... expressions ) { return getCriteria( expressions ).list(); @@ -336,7 +336,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final T get( int id ) { T object = (T) sessionFactory.getCurrentSession().get( getClazz(), id ); @@ -351,7 +351,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final T load( int id ) { T object = (T) sessionFactory.getCurrentSession().load( getClazz(), id ); @@ -383,7 +383,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public final List getAll() { return getSharingCriteria().list(); @@ -446,8 +446,8 @@ protected boolean sharingEnabled() { - return forceAcl() || ( aclService.isShareable( clazz ) && !( currentUserService.getCurrentUser() == null || - CollectionUtils.containsAny( currentUserService.getCurrentUser().getUserCredentials().getAllAuthorities(), AclService.ACL_OVERRIDE_AUTHORITIES ) ) ); + return forceAcl() || (aclService.isShareable( clazz ) && !(currentUserService.getCurrentUser() == null || + CollectionUtils.containsAny( currentUserService.getCurrentUser().getUserCredentials().getAllAuthorities(), AclService.ACL_OVERRIDE_AUTHORITIES ))); } protected boolean isReadAllowed( T object )