← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21114: ProgramService. Cleaned up implementation of get program by current user methods.

 

------------------------------------------------------------
revno: 21114
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-18 17:46:20 +0100
message:
  ProgramService. Cleaned up implementation of get program by current user methods.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java
  dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ShowSendSMSBeneficiaryFormAction.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/program/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2015-11-15 22:07:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2015-11-18 16:46:20 +0000
@@ -30,16 +30,15 @@
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 import java.util.regex.Pattern;
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.trackedentity.TrackedEntity;
-import org.hisp.dhis.user.User;
 import org.hisp.dhis.validation.ValidationCriteria;
 
 /**
  * @author Abyot Asalefew
- * @version $Id$
  */
 public interface ProgramService
 {
@@ -111,30 +110,6 @@
     List<Program> getPrograms( OrganisationUnit organisationUnit );
 
     /**
-     * Get {@link Program} by the current user.
-     *
-     * @return The program list the current user
-     */
-    List<Program> getProgramsByCurrentUser();
-
-    /**
-     * Get {@link Program} by user.
-     *
-     * @return The program list the current user
-     */
-    List<Program> getProgramsByUser( User user );
-
-    /**
-     * Get {@link Program} by the current user and a certain type
-     *
-     * @param type The type of program. There are three types, include Multi
-     *        events with registration, Single event with registration and
-     *        Single event without registration.
-     * @return Program list by a type specified
-     */
-    List<Program> getProgramsByCurrentUser( ProgramType type );
-
-    /**
      * Get {@link Program} included in the expression of a
      * {@link ValidationCriteria}
      *
@@ -173,13 +148,6 @@
     Program getProgram( String uid );
 
     /**
-     * Get {@link Program} belong to an orgunit by the current user
-     *
-     * @param organisationUnit {@link OrganisationUnit}
-     */
-    List<Program> getProgramsByCurrentUser( OrganisationUnit organisationUnit );
-
-    /**
      * Get {@link TrackedEntity} by TrackedEntity
      *
      * @param trackedEntity {@link TrackedEntity}
@@ -220,21 +188,22 @@
     List<Program> getProgramsBetween( int min, int max );
 
     /**
-     * Get {@link Program} by the current user.
+     * Get {@link Program} by the current user. Returns all programs if current
+     * user is superuser. Returns an empty list if there is no current user.
      *
-     * @return The program list the current user
+     * @return Immutable set of programs associated with the current user.
      */
-    List<Program> getByCurrentUser();
+    Set<Program> getCurrentUserPrograms();
 
     /**
      * Get {@link Program} by the current user and a certain type
      *
-     * @param type The type of program. There are three types, include Multi
+     * @param programType The type of program. There are three types, include Multi
      *        events with registration, Single event with registration and
      *        Single event without registration.
-     * @return Program list by a type specified
+     * @return Immutable set of programs associated with the current user.
      */
-    List<Program> getByCurrentUser( ProgramType type );
+    Set<Program> getCurrentUserPrograms( ProgramType programType );
 
     /**
      * Sets the given merge organisation units on the given programs. Only 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java	2015-11-18 15:02:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserService.java	2015-11-18 16:46:20 +0000
@@ -196,13 +196,6 @@
      */
     void updateUserCredentials( UserCredentials userCredentials );
 
-    /**
-     * Retrieves the UserCredentials of the given User.
-     *
-     * @param user the User.
-     * @return the UserCredentials.
-     */
-    UserCredentials getUserCredentials( User user );
 
     /**
      * Retrieves the UserCredentials associated with the User with the given

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-11-15 21:39:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-11-18 16:46:20 +0000
@@ -34,6 +34,7 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -42,11 +43,8 @@
 import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.springframework.transaction.annotation.Transactional;
-
 import com.google.common.collect.Sets;
 
 /**
@@ -81,13 +79,6 @@
         this.currentUserService = currentUserService;
     }
 
-    private UserService userService;
-
-    public void setUserService( UserService userService )
-    {
-        this.userService = userService;
-    }
-    
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -170,39 +161,12 @@
     }
 
     @Override
-    public List<Program> getProgramsByCurrentUser()
-    {
-        return i18n( i18nService, getByCurrentUser() );
-    }
-
-    @Override
-    public List<Program> getProgramsByUser( User user )
-    {
-        return i18n( i18nService, getByUser( user ) );
-    }
-
-    @Override
-    public List<Program> getProgramsByCurrentUser( ProgramType type )
-    {
-        return i18n( i18nService, getByCurrentUser( type ) );
-    }
-
-    @Override
     public Program getProgram( String uid )
     {
         return i18n( i18nService, programStore.getByUid( uid ) );
     }
 
     @Override
-    public List<Program> getProgramsByCurrentUser( OrganisationUnit organisationUnit )
-    {
-        List<Program> programs = new ArrayList<>( getPrograms( organisationUnit ) );
-        programs.retainAll( getProgramsByCurrentUser() );
-
-        return programs;
-    }
-
-    @Override
     public List<Program> getProgramsByTrackedEntity( TrackedEntity trackedEntity )
     {
         return i18n( i18nService, programStore.getByTrackedEntity( trackedEntity ) );
@@ -233,60 +197,22 @@
     }
 
     @Override
-    public List<Program> getByCurrentUser()
-    {
-        return getByUser( currentUserService.getCurrentUser() );
-    }
-
-    public List<Program> getByUser( User user )
-    {
-        List<Program> programs = new ArrayList<>();
-
-        if ( user != null && !user.isSuper() )
-        {
-            Set<UserAuthorityGroup> userRoles = userService.getUserCredentials( currentUserService.getCurrentUser() )
-                .getUserAuthorityGroups();
-
-            for ( Program program : programStore.getAll() )
-            {
-                if ( Sets.intersection( program.getUserRoles(), userRoles ).size() > 0 )
-                {
-                    programs.add( program );
-                }
-            }
-        }
-        else
-        {
-            programs = programStore.getAll();
-        }
-
-        return programs;
+    public Set<Program> getCurrentUserPrograms()
+    {
+        User user = currentUserService.getCurrentUser();
+        
+        if ( user != null )
+        {
+            return user.isSuper() ? Sets.newHashSet( getAllPrograms() ) : user.getUserCredentials().getAllPrograms();
+        }
+        
+        return Sets.newHashSet();
     }
 
     @Override
-    public List<Program> getByCurrentUser( ProgramType type )
-    {
-        List<Program> programs = new ArrayList<>();
-
-        if ( currentUserService.getCurrentUser() != null && !currentUserService.currentUserIsSuper() )
-        {
-            Set<UserAuthorityGroup> userRoles = userService.getUserCredentials( currentUserService.getCurrentUser() )
-                .getUserAuthorityGroups();
-
-            for ( Program program : programStore.getByType( type ) )
-            {
-                if ( Sets.intersection( program.getUserRoles(), userRoles ).size() > 0 )
-                {
-                    programs.add( program );
-                }
-            }
-        }
-        else
-        {
-            programs = programStore.getByType( type );
-        }
-
-        return programs;
+    public Set<Program> getCurrentUserPrograms( ProgramType programType )
+    {        
+        return getCurrentUserPrograms().stream().filter( p -> p.getProgramType() == programType ).collect( Collectors.toSet() );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java	2015-11-18 15:02:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserService.java	2015-11-18 16:46:20 +0000
@@ -562,17 +562,6 @@
     }
 
     @Override
-    public UserCredentials getUserCredentials( User user )
-    {
-        if ( user == null )
-        {
-            return null;
-        }
-
-        return userCredentialsStore.get( user.getId() );
-    }
-
-    @Override
     public UserCredentials getUserCredentialsByUsername( String username )
     {
         return userCredentialsStore.getUserCredentialsByUsername( username );

=== 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-17 17:23:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-11-18 16:46:20 +0000
@@ -1182,7 +1182,6 @@
   <bean id="org.hisp.dhis.program.ProgramService" class="org.hisp.dhis.program.DefaultProgramService">
     <property name="programStore" ref="org.hisp.dhis.program.ProgramStore" />
     <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
-    <property name="userService" ref="org.hisp.dhis.user.UserService" />
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-11-17 19:46:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-11-18 16:46:20 +0000
@@ -181,7 +181,7 @@
 
     private CachingMap<String, DataElement> dataElementCache = new CachingMap<>();
 
-    private List<Program> accessiblePrograms = new ArrayList<>();
+    private Set<Program> accessiblePrograms = new HashSet<>();
 
     // -------------------------------------------------------------------------
     // CREATE
@@ -538,7 +538,7 @@
             }
         }
         
-        if( pr == null &&  !userCredentials.isSuper() && userCredentials.getAllPrograms().size() == 0 )
+        if( pr == null && !userCredentials.isSuper() && userCredentials.getAllPrograms().size() == 0 )
         {
             throw new IllegalQueryException( "User has no access to programs");
         }
@@ -996,7 +996,7 @@
     {
         if ( accessiblePrograms.isEmpty() )
         {
-            accessiblePrograms = new ArrayList<>( programService.getProgramsByUser( user ) );
+            accessiblePrograms = programService.getCurrentUserPrograms();
         }
 
         return !accessiblePrograms.contains( program );

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-10-23 03:41:44 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-11-18 16:46:20 +0000
@@ -1175,16 +1175,16 @@
 
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
 
-        List<Program> tempPrograms = null;
+        Set<Program> tempPrograms = null;
         ProgramType programType = ProgramType.fromValue( type );
 
         if ( programType == ProgramType.WITHOUT_REGISTRATION )
         {
-            tempPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.WITHOUT_REGISTRATION ) );
+            tempPrograms = programService.getCurrentUserPrograms( ProgramType.WITHOUT_REGISTRATION );
         }
         else if ( programType == ProgramType.WITH_REGISTRATION )
         {
-            tempPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.WITH_REGISTRATION ) );
+            tempPrograms = programService.getCurrentUserPrograms( ProgramType.WITH_REGISTRATION );
         }
 
         List<Program> programs = new ArrayList<>();

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2015-10-23 03:41:44 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2015-11-18 16:46:20 +0000
@@ -47,7 +47,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -85,8 +84,7 @@
     {
         Collection<org.hisp.dhis.program.Program> programByUnit = programService.getPrograms( unit );
 
-        Collection<org.hisp.dhis.program.Program> programByCurrentUser = new HashSet<>(
-            programService.getProgramsByCurrentUser() );
+        Collection<org.hisp.dhis.program.Program> programByCurrentUser = programService.getCurrentUserPrograms();
 
         programByCurrentUser.retainAll( programByUnit );
 

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-11-16 22:52:04 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-11-18 16:46:20 +0000
@@ -1572,7 +1572,8 @@
      * @param auths                     authorities to grant to user.
      * @return the user.
      */
-    protected User createUserAndInjectSecurityContext( Set<OrganisationUnit> organisationUnits, Set<OrganisationUnit> dataViewOrganisationUnits, boolean allAuth, String... auths )
+    protected User createUserAndInjectSecurityContext( Set<OrganisationUnit> organisationUnits, 
+        Set<OrganisationUnit> dataViewOrganisationUnits, boolean allAuth, String... auths )
     {
         Assert.notNull( userService, "UserService must be injected in test" );
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java	2015-11-12 04:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java	2015-11-18 16:46:20 +0000
@@ -47,6 +47,7 @@
 
 import java.util.Date;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -98,7 +99,7 @@
 
         if ( userFilter )
         {
-            List<Program> programs = Lists.newArrayList( programService.getProgramsByCurrentUser() );
+            Set<Program> programs = programService.getCurrentUserPrograms();
             entityList.retainAll( programs );
             metaData.setPager( null );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2015-11-18 16:46:20 +0000
@@ -515,15 +515,15 @@
         Set<OrganisationUnit> organisationUnits = new HashSet<>();
         Set<Program> programs = new HashSet<>();
         Map<String, List<Program>> programAssociations = new HashMap<>();
-        List<Program> userPrograms;
+        Set<Program> userPrograms;
 
         if ( type == null )
         {
-            userPrograms = new ArrayList<>( programService.getProgramsByCurrentUser() );
+            userPrograms = programService.getCurrentUserPrograms();
         }
         else
         {
-            userPrograms = new ArrayList<>( programService.getProgramsByCurrentUser( ProgramType.fromValue( type ) ) );
+            userPrograms = programService.getCurrentUserPrograms( ProgramType.fromValue( type ) );
         }
 
         if ( currentUserService.currentUserIsSuper() && currentUser.getOrganisationUnits().isEmpty() )

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java	2015-11-08 18:59:48 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java	2015-11-18 16:46:20 +0000
@@ -150,7 +150,7 @@
         User user = userService.getUser( id );
         UserCredentials credentials = user.getUserCredentials();
         
-        String currentPassword = userService.getUserCredentials( user ).getPassword();
+        String currentPassword = credentials.getPassword();
 
         // ---------------------------------------------------------------------
         // Deny update if user has local authentication and password is wrong

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java	2015-08-25 13:54:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/DeleteCurrentUserAction.java	2015-11-18 16:46:20 +0000
@@ -65,7 +65,7 @@
     {
         this.userService = userService;
     }
-
+    
     @Autowired
     private UserSettingService userSettingService;
 
@@ -119,9 +119,9 @@
     public String execute() throws Exception
     {
         message = "";
-        User user = userService.getUser( currentUserService.getCurrentUser().getId() );
+        User user = currentUserService.getCurrentUser();
 
-        UserCredentials userCredentials = userService.getUserCredentials( user );
+        UserCredentials userCredentials = user.getUserCredentials();
 
         username = userCredentials.getUsername();
         String oldPasswordFromDB = userCredentials.getPassword();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java	2015-10-19 11:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java	2015-11-18 16:46:20 +0000
@@ -242,7 +242,7 @@
                 selectionTreeManager.clearSelectedOrganisationUnits();
             }
             
-            userCredentials = userService.getUserCredentials( user );
+            userCredentials = user.getUserCredentials();
 
             userAuthorityGroups = new ArrayList<>( userCredentials.getUserAuthorityGroups() );            
             userService.canIssueFilter( userAuthorityGroups );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java	2015-11-18 06:20:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java	2015-11-18 16:46:20 +0000
@@ -258,7 +258,7 @@
         user.setEmail( StringUtils.trimToNull( email ) );
         user.setPhoneNumber( StringUtils.trimToNull( phoneNumber ) );
 
-        UserCredentials userCredentials = userService.getUserCredentials( user );
+        UserCredentials userCredentials = user.getUserCredentials();
 
         userCredentials.setExternalAuth( externalAuth );
         userCredentials.setOpenId( StringUtils.trimToNull( openId ) );

=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ShowSendSMSBeneficiaryFormAction.java'
--- dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ShowSendSMSBeneficiaryFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/ShowSendSMSBeneficiaryFormAction.java	2015-11-18 16:46:20 +0000
@@ -112,7 +112,7 @@
     {
         patientAttributes = patientAttributeService.getAllTrackedEntityAttributes();
 
-        programs = programService.getProgramsByCurrentUser();
+        programs = programService.getCurrentUserPrograms();
 
         organisationUnit = selectionManager.getSelectedOrganisationUnit();