Skip to content

Commit 38ba589

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feature/issue3466
2 parents 2cb280c + 628cbc4 commit 38ba589

13 files changed

+2662
-19
lines changed

forms/nht/grantsAndOthersProgressReport.json

+739
Large diffs are not rendered by default.

forms/nht/procurementsOutputReport.json

+827
Large diffs are not rendered by default.

grails-app/controllers/au/org/ala/merit/ProjectController.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ class ProjectController {
986986
render results as JSON
987987
}
988988

989-
@PreAuthorise
989+
@PreAuthorise(accessLevel = 'readOnly')
990990
def scoresForReport(String id) {
991991
List scoreIds = params.getList('scoreIds')
992992
String reportId = params.get('reportId')
@@ -996,7 +996,7 @@ class ProjectController {
996996
render result as JSON
997997
}
998998

999-
@PreAuthorise(accessLevel = 'editor')
999+
@PreAuthorise(accessLevel = 'readOnly')
10001000
def projectTargetsAndScores(String id) {
10011001
boolean approvedDataOnly = params.getBoolean("approvedDataOnly", true)
10021002
Map result = projectService.getServiceDashboardData(id, approvedDataOnly)
@@ -1026,7 +1026,7 @@ class ProjectController {
10261026
render response as JSON
10271027
}
10281028

1029-
@PreAuthorise(accessLevel = 'editor')
1029+
@PreAuthorise(accessLevel = 'readOnly')
10301030
def targetsAndScoresForActivity(String id, String activityId) {
10311031
if (!id || !activityId || !projectService.doesActivityBelongToProject(id, activityId)) {
10321032
error('An invalid activity was selected', id)
@@ -1128,19 +1128,19 @@ class ProjectController {
11281128
* @param id the project id of the project of interest
11291129
* @return a List of outcomes selected in the project MERI plan
11301130
*/
1131-
@PreAuthorise(accessLevel = 'editor')
1131+
@PreAuthorise(accessLevel = 'readOnly')
11321132
def listProjectInvestmentPriorities(String id) {
11331133
List investmentPriorities = projectService.listProjectInvestmentPriorities(id)
11341134
investmentPriorities << "Other"
11351135
render investmentPriorities as JSON
11361136
}
11371137

1138-
@PreAuthorise(accessLevel = 'editor')
1138+
@PreAuthorise(accessLevel = 'readOnly')
11391139
def projectPrioritiesByOutcomeType(String id) {
11401140
render projectService.projectPrioritiesByOutcomeType(id) as JSON
11411141
}
11421142

1143-
@PreAuthorise(accessLevel = 'editor')
1143+
@PreAuthorise(accessLevel = 'readOnly')
11441144
def monitoringProtocolFormCategories() {
11451145
String MONITORING_TAG = 'survey'
11461146
List<Map> forms = activityService.monitoringProtocolForms()
@@ -1150,7 +1150,7 @@ class ProjectController {
11501150
render categories as JSON
11511151
}
11521152

1153-
@PreAuthorise(accessLevel = 'editor')
1153+
@PreAuthorise(accessLevel = 'readOnly')
11541154
def outcomesByScores(String id) {
11551155
List scoreIds = params.getList('scoreIds')
11561156
if (!scoreIds) {

grails-app/services/au/org/ala/merit/ImageService.groovy

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.drew.metadata.exif.GpsDirectory
99
import groovy.util.logging.Slf4j
1010
import groovyx.net.http.HttpResponseDecorator
1111
import grails.core.GrailsApplication
12+
import org.apache.http.HttpStatus
1213

1314
@Slf4j
1415
class ImageService {
@@ -23,14 +24,14 @@ class ImageService {
2324
* @return true if the thumbail was generated.
2425
*/
2526
boolean createThumbnail(InputStream imageIn, File thumbnailFile, String contentType, int size = 300) {
26-
Closure saveThumbnail = { HttpResponseDecorator resp, Object parsedData ->
27-
if (parsedData instanceof InputStream) {
28-
new FileOutputStream(thumbnailFile).withStream { it << parsedData }
27+
28+
Map resp = webService.postMultipart(grailsApplication.config.getProperty('ecodata.baseUrl') + "document/createThumbnail", [size: size], imageIn, contentType, thumbnailFile.name, 'image')
29+
if (resp.statusCode == HttpStatus.SC_OK) {
30+
def thumbnailData = resp.resp
31+
if (thumbnailData instanceof byte[]) {
32+
new FileOutputStream(thumbnailFile).withStream { it << new ByteArrayInputStream(thumbnailData) }
2933
}
3034
}
31-
32-
webService.postMultipart(grailsApplication.config.getProperty('ecodata.baseUrl') + "document/createThumbnail", [size: size], imageIn, contentType, thumbnailFile.name, 'image', saveThumbnail)
33-
3435
return thumbnailFile.exists()
3536

3637
}

src/integration-test/groovy/au/org/ala/fieldcapture/ConfigurableMeriPlanSpec.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class ConfigurableMeriPlanSpec extends StubbedCasSpec {
1616
loginAsAlaAdmin(browser)
1717
to AdminClearCachePage
1818
clearProgramListCache()
19+
at AdminClearCachePage // reset at check time.
1920
clearServiceListCache()
21+
at AdminClearCachePage // reset at check time.
2022
clearProtocolListCache()
2123
}
2224

src/integration-test/groovy/au/org/ala/fieldcapture/HelpLinksSpec.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HelpLinksSpec extends StubbedCasSpec {
2020

2121
when: "Clear the help links cache as other specs will have run caching zero links"
2222
to AdminClearCachePage
23-
homePageDocuments.click()
23+
clearHomePageDocuments()
2424
logout(browser)
2525

2626
then:

src/integration-test/groovy/au/org/ala/fieldcapture/OrganisationDocumentSpec.groovy

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ class OrganisationDocumentsSpec extends StubbedCasSpec {
1313
loginAsAlaAdmin(browser)
1414
to AdminClearCachePage
1515
clearProgramListCache()
16+
at AdminClearCachePage // reset at check time
1617
clearServiceListCache()
1718
}
1819

19-
def cleanup() {
20-
logout(browser)
21-
}
22-
23-
2420
def "documents can be attached to a organisation"() {
2521

2622
setup:

src/integration-test/groovy/pages/AdminClearCachePage.groovy

+8
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,12 @@ class AdminClearCachePage extends ReloadablePage {
5252
waitFor { hasBeenReloaded() }
5353
}
5454
}
55+
56+
void clearHomePageDocuments() {
57+
if (homePageDocuments.displayed) {
58+
homePageDocuments.click()
59+
60+
waitFor { hasBeenReloaded() }
61+
}
62+
}
5563
}

0 commit comments

Comments
 (0)