Changeset 1967 for trunk/grails-app


Ignore:
Timestamp:
Jul 19, 2011, 11:45:21 AM (8 years ago)
Author:
robert@…
Message:
  • Updated restcontroller to also return 'public' property for studies (meaning everyone can read the study)
  • Updated Study.canRead so users that have logged in can also read public/published studies
Location:
trunk/grails-app
Files:
2 edited

Legend:

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

    r1941 r1967  
    173173                                if( study.canRead(authenticationService.getRemotelyLoggedInUser( params.consumer, params.token ))) {
    174174
    175                                         def items = [studyToken:study.giveUUID()]
     175                                        def items = [studyToken:study.giveUUID(), 'public': study.publicstudy]
    176176                                        study.giveFields().each { field ->
    177177                                                def name = field.name
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r1955 r1967  
    399399         */
    400400        public boolean canRead(SecUser loggedInUser) {
     401                // Public studies may be read by anyone
     402                if( this.publicstudy && this.published ) {
     403                        return true;
     404                }
     405               
    401406                // Anonymous readers are only given access when published and public
    402407                if (loggedInUser == null) {
    403                         return this.publicstudy && this.published;
     408                        return false;
    404409                }
    405410
Note: See TracChangeset for help on using the changeset viewer.