Skip to content

Commit

Permalink
Merge pull request #931 from AtlasOfLivingAustralia/feature/issue3171
Browse files Browse the repository at this point in the history
track user in audit messages
  • Loading branch information
temi authored May 2, 2024
2 parents e54afe5 + cf45f19 commit 8e68c51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions grails-app/services/au/org/ala/ecodata/ParatooService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,16 @@ class ParatooService {

Map authHeader = getAuthHeader()
Promise promise = task {
userService.setCurrentUser(userId)
asyncFetchCollection(collection, authHeader, userId, project)
}
promise.onError { Throwable e ->
log.error("An error occurred feching ${collection.orgMintedUUID}: ${e.message}", e)
userService.clearCurrentUser()
}

promise.onComplete { Map result ->
userService.clearCurrentUser()
}

def result
Expand Down
3 changes: 3 additions & 0 deletions src/test/groovy/au/org/ala/ecodata/ParatooServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
]] as JSON).toString()
}
1 * userService.getCurrentUserDetails() >> [userId: userId]
1 * userService.setCurrentUser(userId)

and:
result.updateResult == [status: 'ok']
Expand Down Expand Up @@ -304,6 +305,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
when:
Map result = service.submitCollection(collection, project)
waitAll(result.promise)
println ("finished waiting")

then:
1 * webService.doPost(*_) >> [resp: surveyData]
Expand All @@ -330,6 +332,7 @@ class ParatooServiceSpec extends MongoSpec implements ServiceUnitTest<ParatooSer
]] as JSON).toString()
}
1 * userService.getCurrentUserDetails() >> [userId: userId]
1 * userService.setCurrentUser(userId)

and:
site.name == "SATFLB0001 - Control (100 x 100)"
Expand Down

0 comments on commit 8e68c51

Please sign in to comment.