Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…source only
  • Loading branch information
patkyn committed Aug 4, 2020
1 parent f558dc4 commit 2ecab32
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ class DataController {
if (!keyCheck?.valid) {
return false
}
keyCheck.validApiKey = apiKey
return keyCheck
return true
}

/**
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 2ecab32

Please sign in to comment.