← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14341: remove SharingUtils class, and all its uses

 

------------------------------------------------------------
revno: 14341
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-03-21 13:20:36 +0100
message:
  remove SharingUtils class, and all its uses
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sharing/SharingUtils.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sharing/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sharing/SharingUtils.java	2014-03-21 09:41:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sharing/SharingUtils.java	1970-01-01 00:00:00 +0000
@@ -1,374 +0,0 @@
-package org.hisp.dhis.sharing;
-
-/*
- * Copyright (c) 2004-2014, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dashboard.Dashboard;
-import org.hisp.dhis.datadictionary.DataDictionary;
-import org.hisp.dhis.dataelement.CategoryOptionGroup;
-import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategory;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorGroupSet;
-import org.hisp.dhis.interpretation.Interpretation;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupAccess;
-import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public final class SharingUtils
-{
-    public static Map<Class<? extends IdentifiableObject>, String> EXTERNAL_AUTHORITIES = new HashMap<Class<? extends IdentifiableObject>, String>();
-
-    public static Map<Class<? extends IdentifiableObject>, String> PUBLIC_AUTHORITIES = new HashMap<Class<? extends IdentifiableObject>, String>();
-
-    public static Map<Class<? extends IdentifiableObject>, String> PRIVATE_AUTHORITIES = new HashMap<Class<? extends IdentifiableObject>, String>();
-
-    public static final Map<String, Class<? extends IdentifiableObject>> SUPPORTED_TYPES = new HashMap<String, Class<? extends IdentifiableObject>>();
-
-    public static final List<String> SHARING_OVERRIDE_AUTHORITIES = Arrays.asList( "ALL", "F_METADATA_IMPORT" );
-
-    private static void addType( Class<? extends IdentifiableObject> clazz, String name, String externalAuth, String publicAuth, String privateAuth )
-    {
-        Assert.notNull( clazz );
-        Assert.hasLength( name );
-
-        SUPPORTED_TYPES.put( name, clazz );
-
-        if ( externalAuth != null )
-        {
-            EXTERNAL_AUTHORITIES.put( clazz, externalAuth );
-        }
-
-        if ( publicAuth != null )
-        {
-            PUBLIC_AUTHORITIES.put( clazz, publicAuth );
-        }
-
-        if ( privateAuth != null )
-        {
-            PRIVATE_AUTHORITIES.put( clazz, privateAuth );
-        }
-    }
-
-    static
-    {
-        addType( Document.class, "document", null, "F_DOCUMENT_PUBLIC_ADD", "F_DOCUMENT_PRIVATE_ADD" );
-        addType( Report.class, "report", null, "F_REPORT_PUBLIC_ADD", "F_REPORT_PRIVATE_ADD" );
-        addType( DataSet.class, "dataSet", null, "F_DATASET_PUBLIC_ADD", "F_DATASET_PRIVATE_ADD" );
-        addType( DataDictionary.class, "dataDictionary", null, "F_DATADICTIONARY_PUBLIC_ADD", "F_DATADICTIONARY_PRIVATE_ADD" );
-        addType( DataElement.class, "dataElement", null, "F_DATAELEMENT_PUBLIC_ADD", "F_DATAELEMENT_PRIVATE_ADD" );
-        addType( DataElementCategory.class, "category", null, "F_CATEGORY_PUBLIC_ADD", "F_CATEGORY_PRIVATE_ADD" );
-        addType( DataElementCategoryOption.class, "categoryOption", null, "F_CATEGORY_OPTION_PUBLIC_ADD", "F_CATEGORY_OPTION_PRIVATE_ADD" );
-        addType( CategoryOptionGroup.class, "categoryOptionGroup", null, "F_CATEGORY_OPTION_GROUP_PUBLIC_ADD", "F_CATEGORY_OPTION_GROUP_PRIVATE_ADD" );
-        addType( CategoryOptionGroupSet.class, "categoryOptionGroupSet", null, "F_CATEGORY_OPTION_GROUP_SET_PUBLIC_ADD", "F_CATEGORY_OPTION_GROUP_SET_PRIVATE_ADD" );
-        addType( DataElementCategoryCombo.class, "categoryCombo", null, "F_CATEGORY_COMBO_PUBLIC_ADD", "F_CATEGORY_COMBO_PRIVATE_ADD" );
-        addType( OrganisationUnitGroup.class, "organisationUnitGroup", null, "F_ORGUNITGROUP_PUBLIC_ADD", "F_ORGUNITGROUP_PRIVATE_ADD" );
-        addType( Indicator.class, "indicator", null, "F_INDICATOR_PUBLIC_ADD", "F_INDICATOR_PRIVATE_ADD" );
-        addType( IndicatorGroup.class, "indicatorGroup", null, "F_INDICATORGROUP_PUBLIC_ADD", "F_INDICATORGROUP_PRIVATE_ADD" );
-        addType( IndicatorGroupSet.class, "indicatorGroupSet", null, "F_INDICATORGROUPSET_PUBLIC_ADD", "F_INDICATORGROUPSET_PRIVATE_ADD" );
-        addType( Program.class, "program", null, "F_PROGRAM_PUBLIC_ADD", "F_PROGRAM_PRIVATE_ADD" );
-        addType( UserGroup.class, "userGroup", null, "F_USERGROUP_PUBLIC_ADD", null );
-        
-        addType( org.hisp.dhis.mapping.Map.class, "map", "F_MAP_EXTERNAL", "F_MAP_PUBLIC_ADD", null );
-        addType( Chart.class, "chart", "F_CHART_EXTERNAL", "F_CHART_PUBLIC_ADD", null );
-        addType( ReportTable.class, "reportTable", "F_REPORTTABLE_EXTERNAL", "F_REPORTTABLE_PUBLIC_ADD", null );
-        addType( Report.class, "report", "F_REPORT_EXTERNAL", "F_REPORT_PUBLIC_ADD", "F_REPORT_PRIVATE_ADD" );
-        addType( Document.class, "document", "F_DOCUMENT_EXTERNAL", "F_DOCUMENT_PUBLIC_ADD", "F_DOCUMENT_PRIVATE_ADD" );
-
-        addType( Dashboard.class, "dashboard", null, "F_DASHBOARD_PUBLIC_ADD", null );
-        addType( Interpretation.class, "interpretation", null, null, null );
-    }
-
-    public static boolean isSupported( String type )
-    {
-        return SUPPORTED_TYPES.containsKey( type );
-    }
-
-    public static boolean isSupported( IdentifiableObject object )
-    {
-        return isSupported( object.getClass() );
-    }
-
-    public static boolean isSupported( Class<?> clazz )
-    {
-        return SUPPORTED_TYPES.containsValue( clazz );
-    }
-
-    public static Class<? extends IdentifiableObject> classForType( String type )
-    {
-        return SUPPORTED_TYPES.get( type );
-    }
-
-    /**
-     * Checks if a user can create a public instance of a certain object.
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Does user have the authority to create public instances of that object
-     *
-     * @param user  User to check against
-     * @param clazz Class to check
-     * @return Result of test
-     */
-    public static <T extends IdentifiableObject> boolean canCreatePublic( User user, Class<T> clazz )
-    {
-        Set<String> authorities = user != null ? user.getUserCredentials().getAllAuthorities() : new HashSet<String>();
-        return CollectionUtils.containsAny( authorities, SHARING_OVERRIDE_AUTHORITIES ) || authorities.contains( PUBLIC_AUTHORITIES.get( clazz ) );
-    }
-
-    public static <T> boolean defaultPublic( Class<T> clazz )
-    {
-        return !Dashboard.class.isAssignableFrom( clazz );
-    }
-
-    public static boolean canCreatePublic( User user, IdentifiableObject identifiableObject )
-    {
-        return canCreatePublic( user, identifiableObject.getClass() );
-    }
-
-    public static boolean canCreatePublic( User user, String type )
-    {
-        return canCreatePublic( user, SUPPORTED_TYPES.get( type ) );
-    }
-
-    /**
-     * Checks if a user can create a private instance of a certain object.
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Does user have the authority to create private instances of that object
-     *
-     * @param user  User to check against
-     * @param clazz Class to check
-     * @return Result of test
-     */
-    public static <T extends IdentifiableObject> boolean canCreatePrivate( User user, Class<T> clazz )
-    {
-        Set<String> authorities = user != null ? user.getUserCredentials().getAllAuthorities() : new HashSet<String>();
-        return CollectionUtils.containsAny( authorities, SHARING_OVERRIDE_AUTHORITIES )
-            || PRIVATE_AUTHORITIES.get( clazz ) == null
-            || authorities.contains( PRIVATE_AUTHORITIES.get( clazz ) );
-    }
-
-    public static boolean canCreatePrivate( User user, IdentifiableObject identifiableObject )
-    {
-        return canCreatePrivate( user, identifiableObject.getClass() );
-    }
-
-    public static boolean canCreatePrivate( User user, String type )
-    {
-        return canCreatePrivate( user, SUPPORTED_TYPES.get( type ) );
-    }
-
-    /**
-     * Can user write to this object (create)
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Is the user for the object null?
-     * 3. Is the user of the object equal to current user?
-     * 4. Is the object public write?
-     * 5. Does any of the userGroupAccesses contain public write and the current user is in that group
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static boolean canWrite( User user, IdentifiableObject object )
-    {
-        //TODO ( (object instanceof User) && canCreatePrivate( user, object ) ): review possible security breaches and best way to give update access upon user import
-        if ( sharingOverrideAuthority( user )
-            || (object.getUser() == null && canCreatePublic( user, object ) && PRIVATE_AUTHORITIES.get( object.getClass() ) != null)
-            || (user != null && user.equals( object.getUser() ))
-            //|| authorities.contains( PRIVATE_AUTHORITIES.get( object.getClass() ) )
-            || ((object instanceof User) && canCreatePrivate( user, object ))
-            || AccessStringHelper.canWrite( object.getPublicAccess() ) )
-        {
-            return true;
-        }
-
-        for ( UserGroupAccess userGroupAccess : object.getUserGroupAccesses() )
-        {
-            if ( AccessStringHelper.canWrite( userGroupAccess.getAccess() )
-                && userGroupAccess.getUserGroup().getMembers().contains( user ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Can user read this object
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Is the user for the object null?
-     * 3. Is the user of the object equal to current user?
-     * 4. Is the object public read?
-     * 5. Does any of the userGroupAccesses contain public read and the current user is in that group
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static boolean canRead( User user, IdentifiableObject object )
-    {
-        if ( sharingOverrideAuthority( user )
-            || UserGroup.class.isAssignableFrom( object.getClass() )
-            || object.getUser() == null
-            || user.equals( object.getUser() )
-            || AccessStringHelper.canRead( object.getPublicAccess() ) )
-        {
-            return true;
-        }
-
-        for ( UserGroupAccess userGroupAccess : object.getUserGroupAccesses() )
-        {
-            if ( AccessStringHelper.canRead( userGroupAccess.getAccess() )
-                && userGroupAccess.getUserGroup().getMembers().contains( user ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Can user update this object
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Can user write to this object?
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static boolean canUpdate( User user, IdentifiableObject object )
-    {
-        return canWrite( user, object );
-    }
-
-    /**
-     * Can user delete this object
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Can user write to this object?
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static boolean canDelete( User user, IdentifiableObject object )
-    {
-        return canWrite( user, object );
-    }
-
-    /**
-     * Can user manage (make public) this object
-     * <p/>
-     * 1. Does user have SHARING_OVERRIDE_AUTHORITY authority?
-     * 2. Can user write to this object?
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static boolean canManage( User user, IdentifiableObject object )
-    {
-        if ( sharingOverrideAuthority( user )
-            || (object.getUser() == null && canCreatePublic( user, object ) && PRIVATE_AUTHORITIES.get( object.getClass() ) != null)
-            || user.equals( object.getUser() )
-            || AccessStringHelper.canWrite( object.getPublicAccess() ) )
-        {
-            return true;
-        }
-
-        for ( UserGroupAccess userGroupAccess : object.getUserGroupAccesses() )
-        {
-            if ( AccessStringHelper.canWrite( userGroupAccess.getAccess() )
-                && userGroupAccess.getUserGroup().getMembers().contains( user ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Can user make this object external? (read with no login)
-     *
-     * @param user   User to check against
-     * @param object Object to check
-     * @return Result of test
-     */
-    public static <T extends IdentifiableObject> boolean canExternalize( User user, T object )
-    {
-        if ( user == null )
-        {
-            return false;
-        }
-
-        Set<String> authorities = user.getUserCredentials().getAllAuthorities();
-
-        return EXTERNAL_AUTHORITIES.get( object.getClass() ) != null &&
-            (sharingOverrideAuthority( user ) || authorities.contains( EXTERNAL_AUTHORITIES.get( object.getClass() ) ));
-    }
-
-    private static boolean sharingOverrideAuthority( User user )
-    {
-        return user == null || CollectionUtils.containsAny( user.getUserCredentials().getAllAuthorities(), SHARING_OVERRIDE_AUTHORITIES );
-    }
-
-    private SharingUtils()
-    {
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2014-03-21 09:41:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java	2014-03-21 12:20:36 +0000
@@ -28,29 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.common.DimensionType.CATEGORY;
-import static org.hisp.dhis.common.DimensionType.CATEGORYOPTION_GROUPSET;
-import static org.hisp.dhis.common.DimensionType.DATAELEMENT;
-import static org.hisp.dhis.common.DimensionType.DATAELEMENT_GROUPSET;
-import static org.hisp.dhis.common.DimensionType.DATAELEMENT_OPERAND;
-import static org.hisp.dhis.common.DimensionType.DATASET;
-import static org.hisp.dhis.common.DimensionType.INDICATOR;
-import static org.hisp.dhis.common.DimensionType.ORGANISATIONUNIT;
-import static org.hisp.dhis.common.DimensionType.ORGANISATIONUNIT_GROUPSET;
-import static org.hisp.dhis.common.DimensionType.PERIOD;
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_LEVEL;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_ORGUNIT_GROUP;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_CHILDREN;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_GRANDCHILDREN;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
 import org.hisp.dhis.dataelement.DataElement;
@@ -72,12 +49,22 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.RelativePeriodEnum;
 import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.sharing.SharingUtils;
+import org.hisp.dhis.sharing.SharingService;
 import org.hisp.dhis.system.util.UniqueArrayList;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.hisp.dhis.common.DimensionType.*;
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getUids;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.*;
+
 /**
  * @author Lars Helge Overland
  */
@@ -86,10 +73,10 @@
 {
     @Autowired
     private IdentifiableObjectManager identifiableObjectManager;
-    
+
     @Autowired
     private DataElementCategoryService categoryService;
-    
+
     @Autowired
     private DataElementOperandService operandService;
 
@@ -103,102 +90,105 @@
     private DataElementService dataElementService;
 
     @Autowired
+    private SharingService sharingService;
+
+    @Autowired
     private CurrentUserService currentUserService;
-    
+
     //--------------------------------------------------------------------------
     // DimensionService implementation
     //--------------------------------------------------------------------------
 
     @Override
     public DimensionalObject getDimension( String uid )
-    {        
+    {
         DataElementCategory cat = identifiableObjectManager.get( DataElementCategory.class, uid );
-        
+
         if ( cat != null )
         {
             return cat;
         }
-        
+
         DataElementGroupSet degs = identifiableObjectManager.get( DataElementGroupSet.class, uid );
-        
+
         if ( degs != null )
         {
             return degs;
         }
-        
+
         OrganisationUnitGroupSet ougs = identifiableObjectManager.get( OrganisationUnitGroupSet.class, uid );
-        
+
         if ( ougs != null )
         {
             return ougs;
         }
 
         CategoryOptionGroupSet cogs = identifiableObjectManager.get( CategoryOptionGroupSet.class, uid );
-        
+
         if ( cogs != null )
         {
             return cogs;
         }
-        
+
         return null;
     }
-    
+
     public List<NameableObject> getCanReadDimensionItems( String uid )
     {
         DimensionalObject dimension = getDimension( uid );
-        
+
         List<NameableObject> items = new ArrayList<NameableObject>();
-        
+
         if ( dimension != null && dimension.getItems() != null )
         {
             User user = currentUserService.getCurrentUser();
-            
+
             for ( NameableObject item : dimension.getItems() )
             {
-                boolean canRead = SharingUtils.canRead( user, item );
-                
+                boolean canRead = sharingService.canRead( user, item );
+
                 if ( canRead )
                 {
                     items.add( item );
                 }
             }
         }
-        
+
         return items;
     }
-    
+
     public DimensionType getDimensionType( String uid )
     {
         DataElementCategory cat = identifiableObjectManager.get( DataElementCategory.class, uid );
-        
+
         if ( cat != null )
         {
             return DimensionType.CATEGORY;
-        }        
+        }
 
         DataElementGroupSet degs = identifiableObjectManager.get( DataElementGroupSet.class, uid );
-        
+
         if ( degs != null )
         {
             return DimensionType.DATAELEMENT_GROUPSET;
         }
-        
+
         OrganisationUnitGroupSet ougs = identifiableObjectManager.get( OrganisationUnitGroupSet.class, uid );
-        
+
         if ( ougs != null )
         {
             return DimensionType.ORGANISATIONUNIT_GROUPSET;
         }
 
         CategoryOptionGroupSet cogs = identifiableObjectManager.get( CategoryOptionGroupSet.class, uid );
-        
+
         if ( cogs != null )
         {
             return DimensionType.CATEGORYOPTION_GROUPSET;
         }
-        
+
         final Map<String, DimensionType> dimObjectTypeMap = new HashMap<String, DimensionType>();
-        
+
         dimObjectTypeMap.put( DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X );
         dimObjectTypeMap.put( DimensionalObject.INDICATOR_DIM_ID, DimensionType.INDICATOR );
         dimObjectTypeMap.put( DimensionalObject.DATAELEMENT_DIM_ID, DimensionType.DATAELEMENT );
@@ -206,10 +196,10 @@
         dimObjectTypeMap.put( DimensionalObject.DATAELEMENT_OPERAND_ID, DimensionType.DATAELEMENT_OPERAND );
         dimObjectTypeMap.put( DimensionalObject.PERIOD_DIM_ID, DimensionType.PERIOD );
         dimObjectTypeMap.put( DimensionalObject.ORGUNIT_DIM_ID, DimensionType.ORGANISATIONUNIT );
-        
+
         return dimObjectTypeMap.get( uid );
     }
-    
+
     @Override
     public List<DimensionalObject> getAllDimensions()
     {
@@ -224,7 +214,7 @@
         dimensions.addAll( cogs );
         dimensions.addAll( degs );
         dimensions.addAll( ougs );
-        
+
         return dimensions;
     }
 
@@ -243,10 +233,10 @@
             {
                 object.setUser( currentUserService.getCurrentUser() );
             }
-            
+
             mergeDimensionalObjects( object, object.getColumns() );
             mergeDimensionalObjects( object, object.getRows() );
-            mergeDimensionalObjects( object, object.getFilters() );            
+            mergeDimensionalObjects( object, object.getFilters() );
         }
     }
 
@@ -255,15 +245,15 @@
     //--------------------------------------------------------------------------
 
     /**
-     * Sets persistent objects for dimensional associations on the given 
-     * BaseAnalyticalObject based on the given list of transient DimensionalObjects. 
-     * 
-     * Relative periods represented by enums are converted into a RelativePeriods 
-     * object. User organisation units represented by enums are converted and 
+     * Sets persistent objects for dimensional associations on the given
+     * BaseAnalyticalObject based on the given list of transient DimensionalObjects.
+     * <p/>
+     * Relative periods represented by enums are converted into a RelativePeriods
+     * object. User organisation units represented by enums are converted and
      * represented by the user organisation unit persisted properties on the
      * BaseAnalyticalObject.
-     * 
-     * @param object the BaseAnalyticalObject to merge.
+     *
+     * @param object     the BaseAnalyticalObject to merge.
      * @param dimensions the
      */
     private void mergeDimensionalObjects( BaseAnalyticalObject object, List<DimensionalObject> dimensions )
@@ -272,19 +262,19 @@
         {
             return;
         }
-        
+
         for ( DimensionalObject dimension : dimensions )
         {
             DimensionType type = getDimensionType( dimension.getDimension() );
-            
+
             String dimensionId = dimension.getDimension();
-            
+
             List<NameableObject> items = dimension.getItems();
-            
+
             if ( items != null )
             {
                 List<String> uids = getUids( items );
-                
+
                 if ( INDICATOR.equals( type ) )
                 {
                     object.getIndicators().addAll( identifiableObjectManager.getByUid( Indicator.class, uids ) );
@@ -303,9 +293,9 @@
                 }
                 else if ( PERIOD.equals( type ) )
                 {
-                    List<RelativePeriodEnum> enums = new ArrayList<RelativePeriodEnum>();                
+                    List<RelativePeriodEnum> enums = new ArrayList<RelativePeriodEnum>();
                     List<Period> periods = new UniqueArrayList<Period>();
-                    
+
                     for ( String isoPeriod : uids )
                     {
                         if ( RelativePeriodEnum.contains( isoPeriod ) )
@@ -315,14 +305,14 @@
                         else
                         {
                             Period period = PeriodType.getPeriodFromIsoString( isoPeriod );
-                        
+
                             if ( period != null )
                             {
                                 periods.add( period );
                             }
                         }
                     }
-    
+
                     object.setRelatives( new RelativePeriods().setRelativePeriodsFromEnums( enums ) );
                     object.setPeriods( periodService.reloadPeriods( new ArrayList<Period>( periods ) ) );
                 }
@@ -345,7 +335,7 @@
                         else if ( ou != null && ou.startsWith( KEY_LEVEL ) )
                         {
                             int level = DimensionalObjectUtils.getLevelFromLevelParam( ou );
-                            
+
                             if ( level > 0 )
                             {
                                 object.getOrganisationUnitLevels().add( level );
@@ -354,9 +344,9 @@
                         else if ( ou != null && ou.startsWith( KEY_ORGUNIT_GROUP ) )
                         {
                             String uid = DimensionalObjectUtils.getUidFromOrgUnitGroupParam( ou );
-                            
+
                             OrganisationUnitGroup group = identifiableObjectManager.get( OrganisationUnitGroup.class, uid );
-                            
+
                             if ( group != null )
                             {
                                 object.getItemOrganisationUnitGroups().add( group );
@@ -365,7 +355,7 @@
                         else
                         {
                             OrganisationUnit unit = identifiableObjectManager.get( OrganisationUnit.class, ou );
-                            
+
                             if ( unit != null )
                             {
                                 object.getOrganisationUnits().add( unit );
@@ -378,7 +368,7 @@
                     DataElementCategoryDimension categoryDimension = new DataElementCategoryDimension();
                     categoryDimension.setDimension( categoryService.getDataElementCategory( dimensionId ) );
                     categoryDimension.getItems().addAll( categoryService.getDataElementCategoryOptionsByUid( uids ) );
-                    
+
                     object.getCategoryDimensions().add( categoryDimension );
                 }
                 else if ( DATAELEMENT_GROUPSET.equals( type ) )

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-03-21 09:41:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2014-03-21 12:20:36 +0000
@@ -28,17 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.system.util.PredicateUtils.idObjectCollectionsWithScanned;
-import static org.hisp.dhis.system.util.PredicateUtils.idObjects;
-
-import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hibernate.SessionFactory;
@@ -48,7 +37,6 @@
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.NameableObject;
-import org.hisp.dhis.sharing.SharingUtils;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementOperandService;
 import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -67,6 +55,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.sharing.SharingService;
 import org.hisp.dhis.system.util.CollectionUtils;
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.hisp.dhis.system.util.functional.Function1;
@@ -74,6 +63,17 @@
 import org.hisp.dhis.user.UserCredentials;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.hisp.dhis.system.util.PredicateUtils.idObjectCollectionsWithScanned;
+import static org.hisp.dhis.system.util.PredicateUtils.idObjects;
+
 /**
  * Importer that can handle IdentifiableObject and NameableObject.
  *
@@ -109,7 +109,10 @@
     @Autowired
     private SessionFactory sessionFactory;
 
-    @Autowired(required = false)
+    @Autowired
+    private SharingService sharingService;
+
+    @Autowired( required = false )
     private List<ObjectHandler<T>> objectHandlers;
 
     //-------------------------------------------------------------------------------------------------------
@@ -411,7 +414,7 @@
      */
     protected boolean deleteObject( User user, T persistedObject )
     {
-        if ( !SharingUtils.canDelete( user, persistedObject ) )
+        if ( !sharingService.canDelete( user, persistedObject ) )
         {
             summaryType.getImportConflicts().add(
                 new ImportConflict( ImportUtils.getDisplayName( persistedObject ), "You do not have delete access to class type." ) );
@@ -449,7 +452,7 @@
      */
     protected boolean newObject( User user, T object )
     {
-        if ( !SharingUtils.canCreatePublic( user, object ) && !SharingUtils.canCreatePrivate( user, object ) )
+        if ( !sharingService.canCreatePublic( user, object.getClass() ) && !sharingService.canCreatePrivate( user, object.getClass() ) )
         {
             summaryType.getImportConflicts().add(
                 new ImportConflict( ImportUtils.getDisplayName( object ), "You do not have create access to class type." ) );
@@ -533,7 +536,7 @@
      */
     protected boolean updateObject( User user, T object, T persistedObject )
     {
-        if ( !SharingUtils.canUpdate( user, persistedObject ) )
+        if ( !sharingService.canUpdate( user, persistedObject ) )
         {
             summaryType.getImportConflicts().add(
                 new ImportConflict( ImportUtils.getDisplayName( object ), "You do not have update access to object." ) );

=== 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-21 09:41:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2014-03-21 12:20:36 +0000
@@ -32,16 +32,16 @@
 import org.hisp.dhis.api.controller.exception.NotFoundException;
 import org.hisp.dhis.api.controller.exception.NotFoundForQueryException;
 import org.hisp.dhis.api.utils.WebUtils;
-import org.hisp.dhis.sharing.Access;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.common.PagerUtils;
-import org.hisp.dhis.sharing.SharingUtils;
 import org.hisp.dhis.dxf2.filter.FilterService;
 import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
 import org.hisp.dhis.dxf2.utils.JacksonUtils;
+import org.hisp.dhis.sharing.Access;
+import org.hisp.dhis.sharing.SharingService;
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -84,15 +84,18 @@
     @Autowired
     protected FilterService filterService;
 
+    @Autowired
+    protected SharingService sharingService;
+
     //--------------------------------------------------------------------------
     // GET
     //--------------------------------------------------------------------------
 
     @RequestMapping( value = "/filtered", method = RequestMethod.GET )
     public void getObjectListFiltered(
-        @RequestParam( required = false ) String include,
-        @RequestParam( required = false ) String exclude,
-        @RequestParam( value = "filter", required = false ) List<String> filters,
+        @RequestParam(required = false) String include,
+        @RequestParam(required = false) String exclude,
+        @RequestParam(value = "filter", required = false) List<String> filters,
         @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
     {
         WebOptions options = new WebOptions( parameters );
@@ -143,7 +146,7 @@
         JacksonUtils.toJson( response.getOutputStream(), output );
     }
 
-    @RequestMapping( method = RequestMethod.GET )
+    @RequestMapping(method = RequestMethod.GET)
     public String getObjectList( @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
@@ -170,7 +173,7 @@
         return StringUtils.uncapitalize( getEntitySimpleName() ) + "List";
     }
 
-    @RequestMapping( value = "/query/{query}", method = RequestMethod.GET )
+    @RequestMapping(value = "/query/{query}", method = RequestMethod.GET)
     public String query( @PathVariable String query, @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
@@ -199,8 +202,8 @@
         return StringUtils.uncapitalize( getEntitySimpleName() ) + "List";
     }
 
-    @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
-    public String getObject( @PathVariable( "uid" ) String uid, @RequestParam Map<String, String> parameters,
+    @RequestMapping(value = "/{uid}", method = RequestMethod.GET)
+    public String getObject( @PathVariable("uid") String uid, @RequestParam Map<String, String> parameters,
         Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
@@ -216,7 +219,7 @@
             WebUtils.generateLinks( entity );
         }
 
-        if ( SharingUtils.isSupported( getEntityClass() ) )
+        if ( sharingService.isSupported( getEntityClass() ) )
         {
             addAccessProperties( entity );
         }
@@ -230,7 +233,7 @@
         return StringUtils.uncapitalize( getEntitySimpleName() );
     }
 
-    @RequestMapping( value = "/search/{query}", method = RequestMethod.GET )
+    @RequestMapping(value = "/search/{query}", method = RequestMethod.GET)
     public String search( @PathVariable String query, @RequestParam Map<String, String> parameters,
         Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
@@ -260,13 +263,13 @@
     // POST
     //--------------------------------------------------------------------------
 
-    @RequestMapping( method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } )
+    @RequestMapping(method = RequestMethod.POST, consumes = { "application/xml", "text/xml" })
     public void postXmlObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
     {
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
-    @RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
+    @RequestMapping(method = RequestMethod.POST, consumes = "application/json")
     public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
     {
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
@@ -275,16 +278,16 @@
     // PUT
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" } )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+    @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" })
+    @ResponseStatus(value = HttpStatus.NO_CONTENT)
+    public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream input ) throws Exception
     {
         throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
     }
 
-    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+    @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json")
+    @ResponseStatus(value = HttpStatus.NO_CONTENT)
+    public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream input ) throws Exception
     {
         throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
     }
@@ -293,9 +296,9 @@
     // DELETE
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception
+    @RequestMapping(value = "/{uid}", method = RequestMethod.DELETE)
+    @ResponseStatus(value = HttpStatus.NO_CONTENT)
+    public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid ) throws Exception
     {
         throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() );
     }
@@ -404,12 +407,12 @@
     protected void addAccessProperties( T object )
     {
         Access access = new Access();
-        access.setManage( SharingUtils.canManage( currentUserService.getCurrentUser(), object ) );
-        access.setExternalize( SharingUtils.canExternalize( currentUserService.getCurrentUser(), object ) );
-        access.setWrite( SharingUtils.canWrite( currentUserService.getCurrentUser(), object ) );
-        access.setRead( SharingUtils.canRead( currentUserService.getCurrentUser(), object ) );
-        access.setUpdate( SharingUtils.canUpdate( currentUserService.getCurrentUser(), object ) );
-        access.setDelete( SharingUtils.canDelete( currentUserService.getCurrentUser(), object ) );
+        access.setManage( sharingService.canManage( currentUserService.getCurrentUser(), object ) );
+        access.setExternalize( sharingService.canExternalize( currentUserService.getCurrentUser(), object.getClass() ) );
+        access.setWrite( sharingService.canWrite( currentUserService.getCurrentUser(), object ) );
+        access.setRead( sharingService.canRead( currentUserService.getCurrentUser(), object ) );
+        access.setUpdate( sharingService.canUpdate( currentUserService.getCurrentUser(), object ) );
+        access.setDelete( sharingService.canDelete( currentUserService.getCurrentUser(), object ) );
 
         ((BaseIdentifiableObject) object).setAccess( access );
     }
@@ -426,7 +429,7 @@
             return;
         }
 
-        if ( entityList != null && SharingUtils.isSupported( getEntityClass() ) )
+        if ( entityList != null && sharingService.isSupported( getEntityClass() ) )
         {
             for ( T object : entityList )
             {
@@ -445,7 +448,7 @@
 
     private String entitySimpleName;
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     protected Class<T> getEntityClass()
     {
         if ( entityClass == null )
@@ -477,7 +480,7 @@
         return entitySimpleName;
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     protected T getEntityInstance()
     {
         try

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-03-21 09:41:08 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-03-21 12:20:36 +0000
@@ -28,16 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.common.ListMap;
-import org.hisp.dhis.sharing.SharingUtils;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
@@ -52,10 +44,18 @@
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnitDataSetAssociationSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.sharing.SharingService;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
+import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @author Lars Helge Overland
@@ -103,7 +103,7 @@
     }
 
     private DataElementCategoryService categoryService;
-    
+
     public void setCategoryService( DataElementCategoryService categoryService )
     {
         this.categoryService = categoryService;
@@ -115,7 +115,10 @@
     {
         this.currentUserService = currentUserService;
     }
-    
+
+    @Autowired
+    protected SharingService sharingService;
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -175,28 +178,28 @@
     {
         return emptyOrganisationUnits;
     }
-    
+
     private List<DataElementCategoryCombo> categoryCombos;
 
     public List<DataElementCategoryCombo> getCategoryCombos()
     {
         return categoryCombos;
     }
-    
+
     private List<DataElementCategory> categories;
 
     public List<DataElementCategory> getCategories()
     {
         return categories;
     }
-    
+
     private DataElementCategoryCombo defaultCategoryCombo;
 
     public DataElementCategoryCombo getDefaultCategoryCombo()
     {
         return defaultCategoryCombo;
     }
-    
+
     private ListMap<String, DataElementCategoryOption> categoryOptionMap = new ListMap<String, DataElementCategoryOption>();
 
     public ListMap<String, DataElementCategoryOption> getCategoryOptionMap()
@@ -211,7 +214,7 @@
     public String execute()
     {
         User user = currentUserService.getCurrentUser();
-        
+
         if ( user.getOrganisationUnits().isEmpty() )
         {
             emptyOrganisationUnits = true;
@@ -245,7 +248,7 @@
 
         Set<DataElementCategoryCombo> categoryComboSet = new HashSet<DataElementCategoryCombo>();
         Set<DataElementCategory> categorySet = new HashSet<DataElementCategory>();
-        
+
         for ( DataSet dataSet : dataSets )
         {
             if ( dataSet.getCategoryCombo() != null )
@@ -253,7 +256,7 @@
                 categoryComboSet.add( dataSet.getCategoryCombo() );
             }
         }
-        
+
         for ( DataElementCategoryCombo categoryCombo : categoryComboSet )
         {
             if ( categoryCombo.getCategories() != null )
@@ -261,27 +264,27 @@
                 categorySet.addAll( categoryCombo.getCategories() );
             }
         }
-        
+
         categoryCombos = new ArrayList<DataElementCategoryCombo>( categoryComboSet );
         categories = new ArrayList<DataElementCategory>( categorySet );
-        
+
         for ( DataElementCategory category : categories )
         {
             for ( DataElementCategoryOption categoryOption : category.getCategoryOptions() )
             {
-                if ( SharingUtils.canRead( user, categoryOption ) )
+                if ( sharingService.canRead( user, categoryOption ) )
                 {
                     categoryOptionMap.putValue( category.getUid(), categoryOption );
                 }
             }
         }
-        
+
         Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( categoryCombos, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( categories, IdentifiableObjectNameComparator.INSTANCE );
-        
+
         defaultCategoryCombo = categoryService.getDefaultDataElementCategoryCombo();
-        
+
         return SUCCESS;
     }
 }