Changeset 829


Ignore:
Timestamp:
Aug 23, 2010, 9:29:03 AM (13 years ago)
Author:
keesvb
Message:

started authentication implementation

Location:
trunk
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/NimbleBootStrap.groovy

    r826 r829  
    4949    // Execute any custom Nimble related BootStrap for your application below
    5050
    51         if (dbnp.user.User.count() == 0) {
     51        println "Adding example user..."
     52
     53        if (0 && dbnp.user.User.count() == 0) {
    5254
    5355                // Create example User account
     
    7072                  throw new RuntimeException("Error creating example user")
    7173                }
     74
     75                println "Adding example admin user..."
    7276
    7377                // Create example Administrative account
  • trunk/grails-app/controllers/RestController.groovy

    r773 r829  
    3131      /** Rest resources for Simple Assay Module (SAM) **/
    3232     /**************************************************/
    33    
     33
     34        def beforeInterceptor = [action:this.&auth]
     35        def credentials
     36// defined as a regular method so its private
     37
     38        def auth() {
     39            credentials = nl.metabolomicscentre.dsp.http.BasicAuthentication.credentialsFromRequest(request)
     40                if(false) {
     41                    response.sendError(403)
     42                return false
     43            }
     44        }
     45
    3446
    3547
     
    3850        * Provide a list of all studies.
    3951        *
    40         *
    41         * Examlpe call of the getAssays REST resource: http://localhost:8080/gscf/rest/getAssays/json?externalStudyID=1
    4252        *
    4353        * @return as JSON object list of members externalStudyID, and title for all studies
     
    7484        * Provide a list of all assays for a given study
    7585        *
    76         * @param  externalStudyID
    77         * @return list of assays as JSON object
     86        * Example call of the getAssays REST resource: http://localhost:8080/gscf/rest/getAssays?externalStudyID=PPSH&moduleURL=http://localhost:8182/sam
     87        *
     88        * @param externalStudyID The external study id (code) of the target GSCF Study object
     89        * @param moduleURL The base URL of the calling dbNP module
     90        * @return list of assays in the study as JSON object, filtered to only contain assays for the specified module
    7891        */
    7992        def getAssays = {
    8093                List assays = []
    8194                if( params.externalStudyID ) {
     95                        println params.moduleURL
    8296                        def study = Study.find( "from Study as s where s.code=?", [params.externalStudyID])
    83                         if(study) study.assays.each{ assay ->
    84                             def map = ['name':assay.name, 'externalAssayID':assay.externalAssayID]
    85                                 assays.push( map )
     97                        if(study) study.assays.each{ assay ->
     98                                println assay.module.url
     99                                if (assay.module.url.equals(params.moduleURL)) {
     100                                def map = ['name':assay.name, 'externalAssayID':assay.externalAssayID]
     101                                        assays.push( map )
     102                                }
    86103                        }
    87104                }
Note: See TracChangeset for help on using the changeset viewer.