Changeset 160


Ignore:
Timestamp:
Nov 4, 2010, 11:43:38 AM (6 years ago)
Author:
j.saito@…
Message:

The authentication token is now used in all REST calls.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • grails-app/controllers/RestController.groovy

    r154 r160  
    632632
    633633
    634 
    635 
    636         def test = {
    637                 render CommunicationManager.getSamples("PPSH_Lipidomics_end")
    638         }
    639 
    640634}
    641 
  • grails-app/controllers/data/SimpleAssayController.groovy

    r152 r160  
    1414        def list
    1515        try {
    16                 list = CommunicationManager.getStudies()
     16                list = CommunicationManager.getStudies( session.sessionToken )
    1717        }
    1818        catch (Exception e){
  • grails-app/controllers/importer/ImporterController.groovy

    r157 r160  
    104104
    105105            try {
    106                 def list = CommunicationManager.getStudies()
    107 //                def studies = list.collect{ it['studyToken'] }
    108                 def studies = list.collect { it ['externalStudyID']}
     106                def list = CommunicationManager.getStudies( session.sessionToken )
     107                def studies = list.collect{ it['studyToken'] }
    109108                flow.studies = studies
    110109            }
     
    146145                def assays = []
    147146                def assayNames = []
    148                 CommunicationManager.getAssays( flow.selectedStudyID, grailsApplication.config.grails.serverURL ).each{
     147                CommunicationManager.getAssays( session.sessionToken, flow.selectedStudyID, grailsApplication.config.grails.serverURL ).each{
    149148                    assays.push( ['name':it['name'],'externalAssayId':it['assayToken']] )
    150149                    assayNames.push( it['name'] )
     
    285284            action {
    286285                def studySubjects = []
    287                 for (subject in CommunicationManager.getSubjects(flow.selectedStudyID.toString())){
     286                for (subject in CommunicationManager
     287                                                .getSubjects( session.sessionToken, flow.selectedStudyID.toString() )){
    288288                    studySubjects.add(subject)
    289289                }
     
    719719        def assay = SimpleAssay.find( "from SimpleAssay s where s.externalAssayID = '${externalAssayID}'" )
    720720        def samples = []
    721         for ( i in CommunicationManager.getSamples(externalAssayID) ) {
     721        for ( i in CommunicationManager.getSamples( session.sessionToken, externalAssayID ) ) {
    722722            samples.add( getSample(assay,i) )
    723723        }
  • src/groovy/dbnp/rest/common/CommunicationManager.groovy

    r154 r160  
    4242    public static Object getRestResource( RestServerURL, resource, params ) {
    4343                def url = getRestURL( RestServerURL, resource, params )
     44                println url
     45                println params
    4446            def authString = "${username}:${password}".getBytes().encodeBase64().toString()
    4547            def conn = url.openConnection()
     
    6163        def url = RestServerURL + '/' + resource
    6264                def first = true
     65                params['consumer']=SAMServerURL
    6366                params.each { name, value ->
    6467                        if(first) {
     
    164167    public static registerRestWrapperMethodsGSCFtoSAM() {
    165168        def url = GSCFServerURL + '/rest'
    166                 addRestWrapper( url , 'getStudies' )
    167                 addRestWrapper( url , 'getSubjects', ['studyToken'] )
    168                 addRestWrapper( url , 'getAssays',   ['studyToken','consumer'] )
    169                 addRestWrapper( url , 'getSamples',  ['assayToken'] )
     169                addRestWrapper( url , 'getStudies', ['token'] )
     170                addRestWrapper( url , 'getSubjects', ['token','studyToken'] )
     171                addRestWrapper( url , 'getAssays',   ['token','studyToken','url'] )
     172                addRestWrapper( url , 'getSamples',  ['token','assayToken'] )
    170173    }
    171174
Note: See TracChangeset for help on using the changeset viewer.