← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7993: Add authority to access programs into user role.

 

------------------------------------------------------------
revno: 7993
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-03 22:20:22 +0700
message:
  Add authority to access programs into user role.
added:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetProgramsAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
  dhis-2/dhis-web/dhis-web-commons/pom.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm


--
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/user/UserAuthorityGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java	2012-08-09 13:16:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java	2012-09-03 15:20:22 +0000
@@ -40,6 +40,7 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.program.Program;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -65,6 +66,9 @@
     @Scanned
     private Set<DataSet> dataSets = new HashSet<DataSet>();
 
+    @Scanned
+    private Set<Program> programs = new HashSet<Program>();
+
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------
@@ -170,6 +174,21 @@
         this.dataSets = dataSets;
     }
 
+    @JsonProperty
+    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlElementWrapper( localName = "programs", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "programs", namespace = Dxf2Namespace.NAMESPACE )
+    public Set<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    public void setPrograms( Set<Program> programs )
+    {
+        this.programs = programs;
+    }
+
     @Override
     public void mergeWith( IdentifiableObject other )
     {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2012-04-29 08:31:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java	2012-09-03 15:20:22 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.program.Program;
 
 import java.io.Serializable;
 import java.util.Collection;
@@ -132,6 +133,23 @@
         return dataSets;
     }
 
+
+    /**
+     * Returns a set of the aggregated programs for all user authority groups
+     * of this user credentials.
+     */
+    public Set<Program> getAllPrograms()
+    {
+        Set<Program> programs = new HashSet<Program>();
+
+        for ( UserAuthorityGroup group : userAuthorityGroups )
+        {
+            programs.addAll( group.getPrograms() );
+        }
+
+        return programs;
+    }
+    
     /**
      * Indicates whether this user credentials can issue the given user authority
      * group. First the given authority group must not be null. Second this

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml	2012-03-19 16:35:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserAuthorityGroup.hbm.xml	2012-09-03 15:20:22 +0000
@@ -29,6 +29,11 @@
       <key column="userroleid" foreign-key="fk_userroledataset_userroleid" />
       <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_userroledataset_datasetid" />
     </set>
+    
+    <set name="programs" table="userroleprogram">
+      <key column="userroleid" foreign-key="fk_userroleprogram_userroleid" />
+      <many-to-many column="programid" class="org.hisp.dhis.program.Program" foreign-key="fk_userroleprogram_programid" />
+    </set>
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2012-09-03 15:20:22 +0000
@@ -35,6 +35,9 @@
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -70,6 +73,20 @@
         this.selectedStateManager = selectedStateManager;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -116,6 +133,9 @@
 
         programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit ) );
 
+        UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+        programs.retainAll( userCredentials.getAllPrograms() );
+
         selectedStateManager.setSelectedPatient( patient );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramsByOrgunitAction.java	2012-09-03 15:20:22 +0000
@@ -34,6 +34,9 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -62,7 +65,21 @@
     {
         this.selectedStateManager = selectedStateManager;
     }
-
+    
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
@@ -95,6 +112,8 @@
             programs = programService.getPrograms( organisationUnit );
             Collection<Program> anonymousPrograms = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, organisationUnit );
             programs.removeAll( anonymousPrograms );
+            UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+            programs.retainAll( userCredentials.getAllPrograms() );
         }
         
         selectedStateManager.clearSelectedPatient();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java	2012-06-27 09:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetSingleEventProgramListAction.java	2012-09-03 15:20:22 +0000
@@ -33,6 +33,9 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -62,6 +65,20 @@
         this.programService = programService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -85,8 +102,10 @@
         if ( orgunit != null )
         {
             programs = programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION, orgunit );
+            UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+            programs.retainAll( userCredentials.getAllPrograms() );
         }
-        
+
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java	2012-07-17 14:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadAnonymousProgramsAction.java	2012-09-03 15:20:22 +0000
@@ -36,6 +36,9 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -72,6 +75,20 @@
         this.programService = programService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -109,8 +126,10 @@
         if ( orgunit != null )
         {
             programs = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, orgunit );
+            UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+            programs.retainAll( userCredentials.getAllPrograms() );
         }
-        
+
         levels = organisationUnitService.getOrganisationUnitLevels();
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MultiDataEntrySelectAction.java	2012-09-03 15:20:22 +0000
@@ -36,6 +36,9 @@
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -67,6 +70,20 @@
         this.patientAttributeService = patientAttributeService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -120,6 +137,8 @@
             programs = programService.getPrograms( organisationUnit );
             Collection<Program> anonymousPrograms = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION, organisationUnit );
             programs.removeAll( anonymousPrograms );
+            UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+            programs.retainAll( userCredentials.getAllPrograms() );
         }
         
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-08-28 05:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java	2012-09-03 15:20:22 +0000
@@ -37,6 +37,9 @@
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -79,6 +82,20 @@
         this.selectedStateManager = selectedStateManager;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -115,6 +132,10 @@
 
         patient = patientService.getPatient( id );
 
+        // ---------------------------------------------------------------------
+        // Get programs
+        // ---------------------------------------------------------------------
+
         // Get all programs
         programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
 
@@ -125,11 +146,14 @@
 
         // Except anonymous program
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
-
+        
+        UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+        programs.retainAll( userCredentials.getAllPrograms() );
+        
         // Get single-event if patient no have any single event
         // OR have un-completed single-event
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, false );
-        
+
         for ( ProgramInstance programInstance : programInstances )
         {
             programs.remove( programInstance.getProgram() );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java	2012-06-25 15:09:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java	2012-09-03 15:20:22 +0000
@@ -35,6 +35,9 @@
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -70,6 +73,20 @@
         this.programService = programService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
@@ -113,7 +130,9 @@
 
         programs = programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
         programs.addAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ));
-
+        UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+        programs.retainAll( userCredentials.getAllPrograms() );
+       
         organisationUnit = selectionManager.getSelectedOrganisationUnit();
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-09-03 15:20:22 +0000
@@ -33,6 +33,9 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -61,12 +64,26 @@
         this.programService = programService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
     private OrganisationUnit orgunit;
-    
+
     public OrganisationUnit getOrgunit()
     {
         return orgunit;
@@ -86,11 +103,13 @@
     public String execute()
     {
         orgunit = selectionManager.getSelectedOrganisationUnit();
-        
+
         programs = programService.getPrograms( orgunit );
-        
+
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+        UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+        programs.retainAll( userCredentials.getAllPrograms() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java	2012-07-02 10:21:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/TabularInitializeAction.java	2012-09-03 15:20:22 +0000
@@ -40,6 +40,9 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -76,6 +79,20 @@
         this.programService = programService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -115,15 +132,18 @@
     public String execute()
         throws Exception
     {
-        Collection<OrganisationUnit> rootUnits = new ArrayList<OrganisationUnit>( organisationUnitService
-            .getOrganisationUnitsAtLevel( 1 ) );
+        Collection<OrganisationUnit> rootUnits = new ArrayList<OrganisationUnit>(
+            organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
 
         rootNode = rootUnits.size() > 0 ? rootUnits.iterator().next() : new OrganisationUnit();
 
-        orgunitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+        orgunitGroups = new ArrayList<OrganisationUnitGroup>(
+            organisationUnitGroupService.getAllOrganisationUnitGroups() );
         Collections.sort( orgunitGroups, IdentifiableObjectNameComparator.INSTANCE );
 
         programs = programService.getAllPrograms();
+        UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() );
+        programs.retainAll( userCredentials.getAllPrograms() );
 
         levels = organisationUnitService.getOrganisationUnitLevels();
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-08-28 05:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-09-03 15:20:22 +0000
@@ -41,6 +41,8 @@
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean
@@ -154,6 +156,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean
@@ -163,6 +167,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"
@@ -203,6 +209,8 @@
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="programService"
 			ref="org.hisp.dhis.program.ProgramService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 	
 	<bean
@@ -276,6 +284,8 @@
 		<property name="selectionManager"
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.report.GenerateReportAction"
@@ -405,6 +415,8 @@
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean
@@ -458,6 +470,8 @@
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.GetPatientAction"
@@ -613,6 +627,8 @@
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="selectedStateManager"
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.ProgramEnrollmentAction"
@@ -865,6 +881,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="organisationUnitGroupService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-30 07:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-09-03 15:20:22 +0000
@@ -9,9 +9,7 @@
 				<table class="stage-flow">											
 					<tr id='programStageIdTR_$!programInstance.id'>
 						#foreach( $programStageInstance in $programInstance.programStageInstances )
-						<td width="5px">
-							<img src='images/rightarrow.png'>
-						</td>
+						<td width="5px" style='font-size:25px;'>&rarr;</td>
 						<td>
 							<input type="button" name="programStageBtn"
 								id="ps_$!programStageInstance.id"
@@ -20,7 +18,7 @@
 								programType='$programInstance.program.type'
 								dueDate="$format.formatDate( $programStageInstance.dueDate )"
 								class="stage-object" 
-								value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )" 
+								value="$programStageInstance.programStage.name&#13;&#10;$format.formatDate( $programStageInstance.dueDate )" 
 								onclick="javascript:loadDataEntry( $programStageInstance.id );">
 							<script>	
 								var status = $statusMap.get( $programStageInstance.id ); 
@@ -37,7 +35,7 @@
 		</td>
 		<td>&nbsp;</td>
 		<td>
-			<input type="button" class='stage-object' id="newEncounterBtn_$!programInstance.id" name="newEncounterBtn" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent('$!programInstance.id');" >
+			<input type="button" class='patient-object' id="newEncounterBtn_$!programInstance.id" name="newEncounterBtn" value="$i18n.getString('create_new_event')" onClick="javascript:showCreateNewEvent('$!programInstance.id');" >
 		</td>
 	</tr>			
 </table>
@@ -79,6 +77,7 @@
 </div>
 
 <script>
+	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'" )';
 	var i18n_create_event_success = '$encoder.jsEscape( $i18n.getString( "create_event_success" ) , "'" )';
 	var options = jQuery("#createNewEncounterDiv_$!programInstance.id [id=repeatableProgramStageId] option").length;
 	if( options==0 )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-08-30 07:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-09-03 15:20:22 +0000
@@ -142,15 +142,12 @@
 
 input.stage-object[type="button"]
 {
-	width: 100px;
+	width: 120px;
 	height: 60px;
-    white-space: normal;
-	border: 2px solid; 
-	cursor: pointer;
+    cursor: pointer;
 	opacity: 1.0;
-	border: 1px solid;
+	border: 2px solid;
 	margin: 5px;
-	border-radius: 2px;
 }
 
 input.stage-object[type="button"]:hover

=== modified file 'dhis-2/dhis-web/dhis-web-commons/pom.xml'
--- dhis-2/dhis-web/dhis-web-commons/pom.xml	2012-08-03 11:05:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/pom.xml	2012-09-03 15:20:22 +0000
@@ -35,6 +35,10 @@
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-reporting</artifactId>
     </dependency>
+	<dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-patient</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-support-test</artifactId>

=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetProgramsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetProgramsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetProgramsAction.java	2012-09-03 15:20:22 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2004-2009, 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.
+ */
+
+package org.hisp.dhis.commons.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetProgramsAction.java 9:44:15 PM Sep 3, 2012 $
+ */
+public class GetProgramsAction
+implements Action
+{
+   // -------------------------------------------------------------------------
+   // Dependencies
+   // -------------------------------------------------------------------------
+
+   private ProgramService programService;
+
+   public void setProgramService( ProgramService programService )
+   {
+       this.programService = programService;
+   }
+   
+   // -------------------------------------------------------------------------
+   // Output
+   // -------------------------------------------------------------------------
+
+   private Collection<Program> programs = new ArrayList<Program>();
+
+   public Collection<Program> getPrograms()
+   {
+       return programs;
+   }
+   
+   // -------------------------------------------------------------------------
+   // Action implementation
+   // -------------------------------------------------------------------------
+
+   public String execute()
+       throws Exception
+   {
+       programs = programService.getAllPrograms();
+       
+       return SUCCESS;
+   }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 09:21:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-09-03 15:20:22 +0000
@@ -540,7 +540,12 @@
   </bean>
 
   <bean id="org.hisp.dhis.commons.action.NoAction" class="org.hisp.dhis.commons.action.NoAction" />
-
+ 
+  <bean id="org.hisp.dhis.commons.action.GetProgramsAction" class="org.hisp.dhis.commons.action.GetProgramsAction"
+    scope="prototype">
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+  </bean>
+  
   <!-- Interceptor -->
 
   <bean id="org.hisp.dhis.interceptor.ExceptionInterceptor" class="org.hisp.dhis.interceptor.ExceptionInterceptor">

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-06-29 15:11:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-09-03 15:20:22 +0000
@@ -450,7 +450,7 @@
       </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
-
+    
   </package>
 
   <!-- Common actions HTML -->
@@ -803,6 +803,12 @@
       </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
+    
+    <action name="getPrograms" class="org.hisp.dhis.commons.action.GetProgramsAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonPrograms.vm</result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
 
   </package>
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-08-02 15:14:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-09-03 15:20:22 +0000
@@ -471,6 +471,7 @@
 data_dictionary=Data Dictionary
 data_elements=Data elements
 data_sets=Data sets
+programs=Programs
 indicators=Indicators
 indicator_groups=Indicator groups
 data_element_groups=Data element groups

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-08-24 10:09:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-09-03 15:20:22 +0000
@@ -184,6 +184,7 @@
 			<param name="page">/dhis-web-maintenance-patient/programList.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
 			<param name="javascripts">javascript/program.js</param>
+			<param name="requiredAuthorities">F_PROGRAM_MANAGEMENT</param>
 		</action>
 
 		<action name="getProgram"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddRoleAction.java	2012-09-03 15:20:22 +0000
@@ -32,6 +32,8 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.user.UserAuthorityGroup;
 import org.hisp.dhis.user.UserService;
 
@@ -62,6 +64,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -87,6 +96,13 @@
         this.selectedList = selectedList;
     }
 
+    private Collection<String> selectedProgramList = new ArrayList<String>();
+
+    public void setSelectedProgramList( Collection<String> selectedProgramList )
+    {
+        this.selectedProgramList = selectedProgramList;
+    }
+
     private Collection<String> selectedListAuthority = new ArrayList<String>();
 
     public void setSelectedListAuthority( Collection<String> selectedListAuthority )
@@ -113,6 +129,13 @@
             group.getDataSets().add( dataSet );
         }
 
+        for ( String id : selectedProgramList )
+        {
+            Program program = programService.getProgram( Integer.parseInt( id ) );
+
+            group.getPrograms().add( program );
+        }
+
         group.getAuthorities().addAll( selectedListAuthority );
 
         userService.addUserAuthorityGroup( group );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleAction.java	2012-09-03 15:20:22 +0000
@@ -34,6 +34,8 @@
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.security.authority.SystemAuthoritiesProvider;
 import org.hisp.dhis.user.UserAuthorityGroup;
 import org.hisp.dhis.user.UserService;
@@ -65,13 +67,20 @@
         this.dataSetService = dataSetService;
     }
 
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     private SystemAuthoritiesProvider authoritiesProvider;
 
     public void setAuthoritiesProvider( SystemAuthoritiesProvider authoritiesProvider )
     {
         this.authoritiesProvider = authoritiesProvider;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -122,6 +131,20 @@
         return roleAuthorities;
     }
 
+    private List<Program> availablePrograms;
+
+    public List<Program> getAvailablePrograms()
+    {
+        return availablePrograms;
+    }
+
+    private List<Program> rolePrograms;
+
+    public List<Program> getRolePrograms()
+    {
+        return rolePrograms;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -146,6 +169,20 @@
         Collections.sort( roleDataSets, IdentifiableObjectNameComparator.INSTANCE );
 
         // ---------------------------------------------------------------------
+        // DataSets
+        // ---------------------------------------------------------------------
+
+        availablePrograms = new ArrayList<Program>( programService.getAllPrograms() );
+
+        availablePrograms.removeAll( userAuthorityGroup.getPrograms() );
+
+        Collections.sort( availableDataSets, IdentifiableObjectNameComparator.INSTANCE );
+
+        rolePrograms = new ArrayList<Program>( userAuthorityGroup.getPrograms() );
+
+        Collections.sort( rolePrograms, IdentifiableObjectNameComparator.INSTANCE );
+
+        // ---------------------------------------------------------------------
         // Authorities
         // ---------------------------------------------------------------------
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateRoleAction.java	2012-09-03 15:20:22 +0000
@@ -32,6 +32,8 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.user.UserAuthorityGroup;
 import org.hisp.dhis.user.UserService;
 
@@ -62,6 +64,13 @@
         this.dataSetService = dataSetService;
     }
 
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     private String message;
 
     public String getMessage()
@@ -101,6 +110,13 @@
         this.selectedList = selectedList;
     }
 
+    private Collection<String> selectedProgramList = new ArrayList<String>();
+
+    public void setSelectedProgramList( Collection<String> selectedProgramList )
+    {
+        this.selectedProgramList = selectedProgramList;
+    }
+
     private Collection<String> selectedListAuthority = new ArrayList<String>();
 
     public void setSelectedListAuthority( Collection<String> selectedListAuthority )
@@ -130,6 +146,13 @@
             group.getDataSets().add( dataSet );
         }
 
+        for ( String id : selectedProgramList )
+        {
+            Program program = programService.getProgram( Integer.parseInt( id ) );
+
+            group.getPrograms().add( program );
+        }
+
         group.getAuthorities().addAll( selectedListAuthority );
 
         userService.updateUserAuthorityGroup( group );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml	2012-06-01 13:19:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml	2012-09-03 15:20:22 +0000
@@ -158,6 +158,9 @@
     <property name="dataSetService">
       <ref bean="org.hisp.dhis.dataset.DataSetService" />
     </property>
+    <property name="programService">
+      <ref bean="org.hisp.dhis.program.ProgramService" />
+    </property>
   </bean>
 
   <bean id="org.hisp.dhis.user.action.GetRoleAction" class="org.hisp.dhis.user.action.GetRoleAction" scope="prototype">
@@ -167,6 +170,9 @@
     <property name="dataSetService">
       <ref bean="org.hisp.dhis.dataset.DataSetService" />
     </property>
+    <property name="programService">
+      <ref bean="org.hisp.dhis.program.ProgramService" />
+    </property>
     <property name="authoritiesProvider" ref="org.hisp.dhis.security.authority.SystemAuthoritiesProvider" />
   </bean>
 
@@ -189,6 +195,9 @@
     <property name="dataSetService">
       <ref bean="org.hisp.dhis.dataset.DataSetService" />
     </property>
+    <property name="programService">
+      <ref bean="org.hisp.dhis.program.ProgramService" />
+    </property>
   </bean>
 
   <bean id="org.hisp.dhis.user.action.SetupRoleAction" class="org.hisp.dhis.user.action.SetupRoleAction" scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties	2012-08-02 16:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties	2012-09-03 15:20:22 +0000
@@ -150,6 +150,7 @@
 F_PATIENT_DATAVALUE_ADD = Add Person Data Value
 F_PATIENT_DATAVALUE_UPDATE = Update Person Data Value
 F_PATIENT_DATAVALUE_DELETE = Delete Person Data Value
+F_SMS_REMINDER = SMS Reminder Management 
 F_GENERATE_ACTIVITY_PLANS = Generate Activity Plans
 F_GENERATE_PROGRAM_SUMMARY_REPORT = Generate Program Summary Report
 F_GENERATE_BENEFICIARY_TABULAR_REPORT = Generate Person Tabular report
@@ -157,8 +158,13 @@
 F_GENERATE_PATIENT_CHART = Generate Person Chart
 F_PATIENT_MANAGEMENT = Person Management
 F_NAME_BASED_DATA_ENTRY = Name-Based Data Entry
+F_PROGRAM_MANAGEMENT = Program Management
 F_PROGRAM_ENROLLMENT = Program Enrollment
 F_PROGRAM_UNENROLLMENT = Program Un-Enrollment
+F_PROGRAMSTAGE_SECTION_ADD = Add Program Stage Section
+F_PROGRAMSTAGE_SECTION_DELETE = Delete Program Stage Section
+F_PROGRAMSTAGE_SECTION_MANAGEMENT = Program Stage Section Management
+F_PROGRAMSTAGE_SECTION_UPDATE = Update Program Stage Section
 F_RELATIONSHIP_MANAGEMENT = Person Relationship Management
 F_RELATIONSHIP_ADD = Add Person Relationship
 F_RELATIONSHIP_DELETE = Delete Person Relationship

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2011-06-19 10:30:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2012-09-03 15:20:22 +0000
@@ -13,6 +13,19 @@
 				return option;
 			}
 		});
+		
+		jQuery("#availableProgramList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getPrograms.action",
+			iterator: 'programs',
+			connectedTo: 'selectedProgramList',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
 
 		jQuery("#availableListAuthority").dhisAjaxSelect({
 			source: "getSystemAuthorities.action",
@@ -78,7 +91,25 @@
 			<select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
         </td>
 	</tr>
-		
+	
+	<tr>
+		<td><label>$i18n.getString( "programs" )</label></td>		
+		<td>
+          <select id="availableProgramList" name="availableProgramList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+        </td>
+
+        <td style="text-align:center">
+        	<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableProgramList' );"/><br/>
+            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedProgramList' );"/><br/>
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableProgramList' );"/><br/>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedProgramList' );"/>
+        </td>
+
+		<td>
+			<select id="selectedProgramList" name="selectedProgramList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
+        </td>
+	</tr>
+	
 	<tr>
 		<td><label>$i18n.getString( "authorities" )</label></td>		
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm	2011-06-19 10:30:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm	2012-09-03 15:20:22 +0000
@@ -14,6 +14,19 @@
 			}
 		});
 
+		jQuery("#availableProgramList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getPrograms.action",
+			iterator: 'programs',
+			connectedTo: 'selectedProgramList',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
+		
 		jQuery("#availableListAuthority").dhisAjaxSelect({
 			source: "getSystemAuthorities.action",
 			iterator: 'systemAuthorities',
@@ -87,6 +100,28 @@
 		</tr>
 		
 		<tr>
+			<td><label>$i18n.getString( "programs" )</label></td>		
+			<td>
+			  <select id="availableProgramList" name="availableProgramList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+			</td>
+
+			<td style="text-align:center">
+				<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableProgramList' );"/><br/>
+				<input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedProgramList' );"/><br/>
+				<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableProgramList' );"/><br/>
+				<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedProgramList' );"/>
+			</td>
+
+			<td>
+				<select id="selectedProgramList" name="selectedProgramList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+					#foreach ( $selectedProgram in $rolePrograms )
+						<option value="$selectedProgram.id">$encoder.htmlEncode( $selectedProgram.name )</option>
+					#end
+				</select>
+			</td>
+		</tr>
+		
+		<tr>
 			<td><label>$i18n.getString( "authorities" )</label></td>
 
 			<td>