From 2ecab32521e42ac2b5f772ab2b203058e4e357e4 Mon Sep 17 00:00:00 2001 From: Patricia Koh Date: Wed, 5 Aug 2020 07:47:19 +1000 Subject: [PATCH] https://github.com/AtlasOfLivingAustralia/ala-infrastructure/issues/669 - pass flag for data resource only --- .../au/org/ala/collectory/DataController.groovy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/grails-app/controllers/au/org/ala/collectory/DataController.groovy b/grails-app/controllers/au/org/ala/collectory/DataController.groovy index bb7d91a0..ec8e2a49 100644 --- a/grails-app/controllers/au/org/ala/collectory/DataController.groovy +++ b/grails-app/controllers/au/org/ala/collectory/DataController.groovy @@ -191,8 +191,7 @@ class DataController { if (!keyCheck?.valid) { return false } - keyCheck.validApiKey = apiKey - return keyCheck + return true } /** @@ -333,12 +332,17 @@ class DataController { } else { def urlForm = params.entity def clazz = capitalise(urlForm) - def keyCheck = checkApiKey() if (params.pg) { // return specified entity addContentLocation "/ws/${urlForm}/${params.pg.uid}" def eTag = (params.pg.uid + ":" + params.pg.lastUpdated).encodeAsMD5() - def entityInJson = crudService."read${clazz}"(params.pg, keyCheck && keyCheck.validApiKey?:null) + def entityInJson + if (clazz == 'DataResource') { + def keyCheck = checkApiKey() + entityInJson = crudService."read${clazz}"(params.pg, keyCheck) + } else { + entityInJson = crudService."read${clazz}"(params.pg) + } entityInJson = metadataService.convertAnyLocalPaths(entityInJson) response.setContentType("application/json") response.setCharacterEncoding("UTF-8")