dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40371
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20460: make sure that orgUnit has program assigned to it when doing scope validation for orgUnit+program...
------------------------------------------------------------
revno: 20460
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-02 15:20:19 +0700
message:
make sure that orgUnit has program assigned to it when doing scope validation for orgUnit+program scopes
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java 2015-09-30 08:57:38 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java 2015-10-02 08:20:19 +0000
@@ -219,6 +219,12 @@
{
Assert.notNull( program, "program is required for program scope" );
Assert.notNull( organisationUnit, "organisationUnit is required for org unit scope" );
+
+ if ( !program.getOrganisationUnits().contains( organisationUnit ) )
+ {
+ return "Given orgUnit is not assigned to program " + program.getUid();
+ }
+
params.setProgram( program );
params.addOrganisationUnit( organisationUnit );
params.setOrganisationUnitMode( OrganisationUnitSelectionMode.SELECTED );