← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10290: [mobile] limit access to programs by user role

 

------------------------------------------------------------
revno: 10290
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2013-03-18 17:02:07 +0700
message:
  [mobile] limit access to programs by user role
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java	2013-03-18 08:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/GetAllAnonymousProgramAction.java	2013-03-18 10:02:07 +0000
@@ -98,7 +98,7 @@
     public String execute()
         throws Exception
     {
-        programs = programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION );
+        programs = programService.getProgramsByCurrentUser( Program.SINGLE_EVENT_WITHOUT_REGISTRATION );
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2013-03-18 09:30:19 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetPatientProgramListAction.java	2013-03-18 10:02:07 +0000
@@ -257,9 +257,10 @@
         relatedPeople = new HashMap<Relationship, Patient>();
 
         patient = patientService.getPatient( patientId );
+        Collection<Program> programByCurrentUser = programService.getProgramsByCurrentUser();
         for ( ProgramInstance programInstance : programInstanceService.getProgramInstances( patient ) )
         {
-            if ( !programInstance.isCompleted() )
+            if ( !programInstance.isCompleted() && programByCurrentUser.contains( programInstance.getProgram() ) )
             {
                 programInstances.add( programInstance );
             }
@@ -303,7 +304,7 @@
     private List<Program> generateEnrollmentProgramList()
     {
         List<Program> programs = new ArrayList<Program>();
-        for ( Program program : programService.getPrograms( patient.getOrganisationUnit() ) )
+        for ( Program program : programService.getProgramsByCurrentUser() )
 
         {
             if ( program.isSingleEvent() && program.isRegistration() )