- Timestamp:
- Jan 4, 2011, 11:13:45 AM (10 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrapStudies.groovy
r1245 r1328 400 400 url: config.modules.metabolomics.url 401 401 ).with { if (!validate()) { errors.each { println it} } else save()} 402 402 403 // Add metabolomics assay reference 404 def metagenomicsModule = new AssayModule( 405 name: 'Metagenomics module', 406 platform: 'High throughput sequencing', 407 url: config.modules.metagenomics.url 408 ).with { if (!validate()) { errors.each { println it} } else save()} 409 403 410 def lipidAssayRef = new Assay( 404 411 name: 'Lipid profiling', … … 452 459 ).setFieldValue('Spectrometry technique', 'GC/MS') 453 460 461 462 // Add sequencing (metagenomics) assays 463 def sequencingAssay16SRef = new Assay( 464 name : '16S Sequencing assay', 465 template : ccAssayTemplate, 466 module : metagenomicsModule, 467 externalAssayID: 'PPSH-SEQ-16S' 468 ) 469 470 // Add sequencing (metagenomics) assays 471 def sequencingAssay18SRef = new Assay( 472 name : '18S Sequencing assay', 473 template : ccAssayTemplate, 474 module : metagenomicsModule, 475 externalAssayID: 'PPSH-SEQ-18S' 476 ) 477 454 478 humanStudy.samples*.each { 455 479 if (it.parentEvent.startTime == 0) { … … 460 484 glucoseAssayARef.addToSamples(it) 461 485 metAssayRefA.addToSamples(it) 486 sequencingAssay16SRef.addToSamples(it) 487 sequencingAssay18SRef.addToSamples(it) 462 488 } 463 489 } 464 490 491 humanStudy.addToAssays(sequencingAssay16SRef) 492 humanStudy.addToAssays(sequencingAssay18SRef) 465 493 humanStudy.addToAssays(glucoseAssayARef) 466 494 humanStudy.addToAssays(glucoseAssayBRef) -
trunk/grails-app/conf/Config.groovy
r1323 r1328 59 59 url = "http://localhost:8183/nmcdsp" 60 60 } 61 metagenomics { 62 url = "http://localhost:8184/metagenomics" 63 } 61 64 } 62 65 } … … 71 74 url = "http://ci.metabolomics.nmcdsp.org" 72 75 } 76 metagenomics { 77 url = "http://ci.metagenomics.nmcdsp.org" 78 } 73 79 } 74 80 } -
trunk/grails-app/controllers/RestController.groovy
r1222 r1328 95 95 * @return JSON object list containing 'studyToken', and 'name' (title) for each study 96 96 * 97 * If one study is requested, a 404 error might occur if the study doesn't exist, and a 401 error if the user is not 98 * authorized to access this study. If multiple studies are requrested, non-existing studies or studies for which the 99 * user is not authorized are not returned in the list (so the list might be empty). 97 100 * 98 101 * Example 1. REST call without studyToken. … … 134 137 } 135 138 else if( params.studyToken instanceof String ) { 136 studies.push Study.findByCode( params.studyToken ) 139 def study = Study.findByCode( params.studyToken ) 140 if( study ) { 141 if( !study.canRead(AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token )) ) { 142 response.sendError(401) 143 return false 144 } 145 146 studies.push study 147 } else { 148 response.sendError(404) 149 return false 150 } 151 137 152 } 138 153 else { 139 154 params.studyToken.each{ studyToken -> 140 studies.push Study.findByCode( studyToken ) 141 } 142 } 155 def study = Study.findByCode( studyToken ); 156 if( study ) 157 studies.push study 158 } 159 } 160 143 161 144 162 studies.each { study -> … … 171 189 * Provide a list of all subjects belonging to a study. 172 190 * 173 * If the user is not allowed to read the study contents, a 401 error is given 191 * If the user is not allowed to read the study contents, a 401 error is given. If the study doesn't exist, a 404 error is given 174 192 * 175 193 * @param studyToken String The external study id (code) of the target GSCF Study object … … 192 210 193 211 study.subjects.each { subjects.push it.name } 212 } else { 213 response.sendError(404) 214 return false 194 215 } 195 216 } … … 203 224 * Provide a list of all assays for a given study. 204 225 * 205 * If the user is not allowed to read the study contents, a 401 error is given 226 * If the user is not allowed to read the study contents, a 401 error is given. If the study doesn't exist, a 404 error is given 206 227 * 207 228 * @param studyToken String The external study id (code) of the target GSCF Study object … … 297 318 } 298 319 } 299 } 320 } else { 321 response.sendError(404) 322 return false 323 } 300 324 301 325 } … … 313 337 * Provide all samples of a given Assay. The result is an enriched list with additional information for each sample. 314 338 * 339 * If the user is not allowed to read the study contents, a 401 error is given. If the assay doesn't exist, a 404 error is given 340 * 315 341 * @param assayToken String (assayToken of some Assay in GSCF) 316 342 * @param sampleToken Optional parameter. One or more sampleTokens to specify what sample to give exectly. … … 370 396 371 397 if( assay ) { 398 // Check whether the person is allowed to read the data of this study 399 if( !assay.parent.canRead(AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token ))) { 400 response.sendError(401) 401 return false 402 } 403 372 404 def samples = assay.getSamples() // on all samples 373 405 … … 427 459 items.push item 428 460 } 461 } else { 462 // Assay not found 463 response.sendError(404) 464 return false 429 465 } 430 466 } … … 468 504 } 469 505 470 471 472 473 474 475 506 }
Note: See TracChangeset
for help on using the changeset viewer.