Changeset 2186
- Timestamp:
- Mar 28, 2012, 2:29:09 PM (11 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/api/ApiController.groovy
r2185 r2186 42 42 def result = [:] 43 43 try { 44 // TODO - check if token belongs to current user? 44 45 if (!token) { 45 46 // generate a token for this device 46 47 token = new Token( 47 deviceID: params.deviceID, 48 deviceToken: UUID.randomUUID().toString(), 49 sequence: 0 48 deviceID : params.deviceID, 49 deviceToken : UUID.randomUUID().toString(), 50 user : authenticationService.getLoggedInUser(), 51 sequence : 0 50 52 ).save(failOnError: true) 51 53 } … … 81 83 response.sendError(401, 'Unauthorized') 82 84 } else { 83 def user = authenticationService.getLoggedInUser() 85 // def user = authenticationService.getLoggedInUser() 86 def user = Token.findByDeviceID(deviceID).user 84 87 def readableStudies = Study.giveReadableStudies(user) 85 88 def studies = [] … … 132 135 133 136 // fetch user and study 134 def user = authenticationService.getLoggedInUser() 137 // def user = authenticationService.getLoggedInUser() 138 def user = Token.findByDeviceID(deviceID).user 135 139 def study = Study.findByStudyUUID(studyToken) 136 140 … … 195 199 196 200 // fetch user and study 197 def user = authenticationService.getLoggedInUser() 201 // def user = authenticationService.getLoggedInUser() 202 def user = Token.findByDeviceID(deviceID).user 198 203 def study = Study.findByStudyUUID(studyToken) 199 204 -
trunk/grails-app/views/api/index.gsp
r2184 r2186 112 112 <h2>example reply</h2> 113 113 <blockquote> 114 {"count":2,"studies":[{"t itle":"NuGO PPS human study","description":"Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.","subjects":11,"species":["Homo sapiens"],"assays":["Mass Sequencing module","SAM module for clinical data","Metabolomics module"],"events":1,"uniqueEvents":["start: 3 days, 22 hours, duration: 8 hours"],"samplingEvents":2,"uniqueSamplingEvents":["start: 0 seconds","start: 4 days, 6 hours"],"eventGroups":1,"uniqueEventGroups":["Root group"],"samples":22},{"title":"NuGO PPS3 mouse study leptin module","description":"C57Bl/6 mice were fed a high fat (45 en%) or low fat (10 en%) diet after a four week run-in on low fat diet.","subjects":80,"species":["Mus musculus"],"assays":["SAM module for clinical data","Metabolomics module"],"events":8,"uniqueEvents":["start: 1 hour, duration: 1 week","start: 1 hour, duration: 4 weeks"],"samplingEvents":2,"uniqueSamplingEvents":["start: 1 week, 1 hour"],"eventGroups":8,"uniqueEventGroups":["10% fat + vehicle for 1 week","10% fat + leptin for 1 week","45% fat + vehicle for 1 week","45% fat + leptin for 1 week","10% fat + vehicle for 4 weeks","10% fat + leptin for 4 weeks","45% fat + vehicle for 4 weeks","45% fat + leptin for 4 weeks"],"samples":80}]}114 {"count":2,"studies":[{"token":"f2e085fb-9138-4ebe-a59f-82f1bdc21d7e","title":"NuGO PPS human study","description":"Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.","subjects":11,"species":["Homo sapiens"],"assays":["Mass Sequencing module","SAM module for clinical data","Metabolomics module"],"events":1,"uniqueEvents":["start: 3 days, 22 hours, duration: 8 hours"],"samplingEvents":2,"uniqueSamplingEvents":["start: 0 seconds","start: 4 days, 6 hours"],"eventGroups":1,"uniqueEventGroups":["Root group"],"samples":22},{"token":"6b7e85b3-b174-492c-ba27-fbfb71ab9b8b","title":"NuGO PPS3 mouse study leptin module","description":"C57Bl/6 mice were fed a high fat (45 en%) or low fat (10 en%) diet after a four week run-in on low fat diet.","subjects":80,"species":["Mus musculus"],"assays":["SAM module for clinical data","Metabolomics module"],"events":8,"uniqueEvents":["start: 1 hour, duration: 1 week","start: 1 hour, duration: 4 weeks"],"samplingEvents":2,"uniqueSamplingEvents":["start: 1 week, 1 hour"],"eventGroups":8,"uniqueEventGroups":["10% fat + vehicle for 1 week","10% fat + leptin for 1 week","45% fat + vehicle for 1 week","45% fat + leptin for 1 week","10% fat + vehicle for 4 weeks","10% fat + leptin for 4 weeks","45% fat + vehicle for 4 weeks","45% fat + leptin for 4 weeks"],"samples":80}]} 115 115 </blockquote> 116 116 </p>
Note: See TracChangeset
for help on using the changeset viewer.