@@ -27,6 +27,7 @@ import org.apache.commons.io.FilenameUtils
27
27
import org.apache.http.HttpStatus
28
28
import org.apache.http.entity.ContentType
29
29
import org.grails.web.json.JSONArray
30
+ import org.grails.web.json.JSONObject
30
31
import org.springframework.context.MessageSource
31
32
import org.springframework.web.multipart.MultipartFile
32
33
@@ -1866,7 +1867,7 @@ class BioActivityController {
1866
1867
log. debug(" includeSiteData = ${ includeSiteData} " )
1867
1868
1868
1869
String userId = userService. getCurrentUserId()
1869
- def activity = activityService. get(id)
1870
+ def activity = activityService. get(id, null , userId, false ,includeSiteData )
1870
1871
String projectId = activity?. projectId
1871
1872
def model = [:]
1872
1873
@@ -1880,12 +1881,11 @@ class BioActivityController {
1880
1881
} else if (! projectId) {
1881
1882
model. error = " No project associated with the activity"
1882
1883
} else if (projectService. isUserAdminForProject(userId, projectId) || activityService. isUserOwnerForActivity(userId, activity?. activityId)) {
1883
- model = [activity : activity]
1884
1884
if (includeSiteData) {
1885
- def activitySite = siteService . get(model . activity. siteId, [ view : ' brief ' ])
1886
- model . site = [ siteId : activitySite . siteId, name :activitySite . name, geoJson :activitySite . geoIndex]
1885
+ activity . site = new JSONObject ([ siteId : activity. site . siteId, name :activity . site . name, geoJson :activity . site . geoIndex ])
1886
+ activity . remove( ' siteId' )
1887
1887
}
1888
-
1888
+ model = [ activity : activity]
1889
1889
} else {
1890
1890
response. status = 401
1891
1891
model. error = " Access denied: User is not an owner of this activity ${ activity?.activityId} "
0 commit comments