Changeset 976 for trunk/grails-app
- Timestamp:
- Oct 21, 2010, 5:28:04 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 32 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BaseFilters.groovy
r776 r976 29 29 } 30 30 } 31 31 32 } 32 33 } -
trunk/grails-app/conf/BootStrap.groovy
r939 r976 6 6 import org.codehaus.groovy.grails.commons.GrailsApplication 7 7 import grails.util.GrailsUtil 8 import org.nmcdsp.plugins.aaaa.SecUser8 import dbnp.authentication.* 9 9 10 10 … … 26 26 System.setProperty('user.timezone', 'CET') 27 27 28 def user = SecUser.findByUsername('user') ?: new SecUser( 28 def adminRole = SecRole.findByAuthority( 'ROLE_ADMIN' ) ?: new SecRole( authority: 'ROLE_ADMIN' ).save() 29 30 def user = SecUser.findByUsername('user') ?: new SecUser( 29 31 username: 'user', 30 password: springSecurityService.encodePassword('useR123!'), 31 enabled: true).save(failOnError: true) 32 password: springSecurityService.encodePassword( 'useR123!', 'user' ), 33 email: 'user@dbnp.org', 34 userConfirmed: true, adminConfirmed: true).save(failOnError: true) 32 35 33 36 def userAdmin = SecUser.findByUsername('admin') ?: new SecUser( 34 37 username: 'admin', 35 password: springSecurityService.encodePassword('admiN123!'), 36 enabled: true).save(failOnError: true) 38 password: springSecurityService.encodePassword( 'admiN123!', 'admin' ), 39 email: 'admin@dbnp.org', 40 userConfirmed: true, adminConfirmed: true).save(failOnError: true) 41 42 // Make the admin user an administrator 43 SecUserSecRole.create userAdmin, adminRole, true 37 44 38 45 def userTest = SecUser.findByUsername('test') ?: new SecUser( 39 46 username: 'test', 40 password: springSecurityService.encodePassword('testT123!'), 41 enabled: true).save(failOnError: true) 42 43 println "Done with SpringSecurity bootstrap, created [user, admin, test]." 47 password: springSecurityService.encodePassword( 'useR123!', 'test' ), 48 email: 'test@dbnp.org', 49 userConfirmed: true, adminConfirmed: true).save(failOnError: true) 50 51 println "Done with SpringSecurity bootstrap, created [user, admin, test]." 44 52 45 53 // If there are no templates yet in the database … … 81 89 } else { 82 90 // general study boostrapping 83 BootStrapStudies.addExampleStudies(user )91 BootStrapStudies.addExampleStudies(user, userAdmin) 84 92 } 85 93 } -
trunk/grails-app/conf/BootStrapStudies.groovy
r948 r976 21 21 */ 22 22 23 public static void addExampleStudies( org.nmcdsp.plugins.aaaa.SecUser owner) {23 public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser ) { 24 24 25 25 // Look up the used ontologies which should be in the database by now … … 171 171 ecCode:"2007117.c", 172 172 startDate: Date.parse('yyyy-MM-dd','2008-01-02'), 173 owner: owner 173 owner: owner, 174 readers: [otherUser] 174 175 ).with { if (!validate()) { errors.each { println it} } else save()} 175 176 … … 378 379 ecCode:"unknown", 379 380 startDate: Date.parse('yyyy-MM-dd','2008-01-14'), 380 owner: owner 381 owner: owner, 382 writers: [otherUser] 381 383 ) 382 384 .setFieldValue( 'Description', "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U." ) -
trunk/grails-app/conf/Config.groovy
r936 r976 157 157 158 158 // Needed for the Spring Security Core plugin: 159 grails.plugins.springsecurity.userLookup.userDomainClassName = 'org.nmcdsp.plugins.aaaa.SecUser' 160 grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'org.nmcdsp.plugins.aaaa.SecUserSecRole' 161 grails.plugins.springsecurity.authority.className = 'org.nmcdsp.plugins.aaaa.SecRole' 159 grails.plugins.springsecurity.userLookup.userDomainClassName = 'dbnp.authentication.SecUser' 160 grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'dbnp.authentication.SecUserSecRole' 161 grails.plugins.springsecurity.authority.className = 'dbnp.authentication.SecRole' 162 grails.plugins.springsecurity.password.algorithm = 'SHA-256' 163 grails.plugins.springsecurity.password.encodeHashAsBase64 = true 164 grails.plugins.springsecurity.dao.reflectionSaltSourceProperty = 'username' // Use the persons username as salt for encryption 165 grails.plugins.springsecurity.securityConfigType = grails.plugins.springsecurity.SecurityConfigType.Annotation 166 167 // Make sure the different controllers provided by springsecurity.ui are only accessible by administrators 168 // NB: the RegisterController is used for forgotten passwords. It should be accessible by anyone 169 grails.plugins.springsecurity.controllerAnnotations.staticRules = [ 170 '/user/**': ['ROLE_ADMIN'], 171 '/role/**': ['ROLE_ADMIN'], 172 '/aclclass/**': ['ROLE_ADMIN'], 173 '/aclentry/**': ['ROLE_ADMIN'], 174 '/aclobjectidentity/**': ['ROLE_ADMIN'], 175 '/aclsid/**': ['ROLE_ADMIN'], 176 '/persistentlogin/**': ['ROLE_ADMIN'], 177 '/registrationcode/**': ['ROLE_ADMIN'], 178 '/requestmap/**': ['ROLE_ADMIN'], 179 '/securityinfo/**': ['ROLE_ADMIN'] 180 ] 181 182 183 // Needed for sending emails 184 grails { 185 mail { 186 host = "smtp.gmail.com" 187 port = 465 188 username = "gscfproject@gmail.com" 189 password = "gscf2010" 190 props = [ 191 "mail.smtp.auth":"true", 192 "mail.smtp.socketFactory.port": '465', 193 "mail.smtp.socketFactory.class": "javax.net.ssl.SSLSocketFactory", 194 "mail.smtp.socketFactory.fallback": "false" 195 ] 196 } 197 } 162 198 163 199 // The OAuth consumer key and secret variables are currently replaced by Jeroen's Continuous Integration script. … … 173 209 } 174 210 } 211 -
trunk/grails-app/controllers/RestController.groovy
r963 r976 18 18 import dbnp.studycapturing.Study 19 19 import dbnp.studycapturing.Assay 20 import org.nmcdsp.plugins.aaaa.SecUser20 import dbnp.authentication.SecUser 21 21 import grails.converters.* 22 22 import nl.metabolomicscentre.dsp.http.BasicAuthentication -
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r959 r976 31 31 import grails.converters.JSON 32 32 import org.apache.poi.hssf.usermodel.HSSFWorkbook 33 33 import grails.plugins.springsecurity.Secured 34 35 @Secured(['IS_AUTHENTICATED_REMEMBERED']) 34 36 class ImporterController { 35 37 def ImporterService -
trunk/grails-app/controllers/dbnp/studycapturing/StudyController.groovy
r959 r976 2 2 3 3 import grails.converters.* 4 import grails.plugins.springsecurity.Secured 5 4 6 5 7 /** … … 7 9 */ 8 10 class StudyController { 9 11 def AuthenticationService 12 10 13 //static allowedMethods = [save: "POST", update: "POST", delete: "POST"] 11 14 … … 14 17 } 15 18 19 /** 20 * Shows all studies where the user has access to 21 */ 16 22 def list = { 17 params.max = Math.min(params.max ? params.int('max') : 10, 100) 18 [studyInstanceList: Study.list(params), studyInstanceTotal: Study.count()] 23 24 def user = AuthenticationService.getLoggedInUser() 25 def max = Math.min(params.max ? params.int('max') : 10, 100) 26 27 def c = Study.createCriteria() 28 29 def studies 30 if( user == null ) { 31 studies = c.list { 32 maxResults(max) 33 and { 34 eq( "published", true ) 35 eq( "publicstudy", true ) 36 } 37 } 38 } else { 39 studies = c.list { 40 maxResults(max) 41 or { 42 eq( "owner", user ) 43 writers { 44 eq( "id", user.id ) 45 } 46 and { 47 readers { 48 eq( "id", user.id ) 49 } 50 eq( "published", true ) 51 } 52 } 53 } 54 } 55 56 [studyInstanceList: studies, studyInstanceTotal: studies.count()] 57 } 58 59 /** 60 * Shows studies for which the logged in user is the owner 61 */ 62 @Secured(['IS_AUTHENTICATED_REMEMBERED']) 63 def myStudies = { 64 def user = AuthenticationService.getLoggedInUser() 65 def max = Math.min(params.max ? params.int('max') : 10, 100) 66 67 def studies = Study.findAllByOwner(user); 68 render( view: "list", model: [studyInstanceList: studies, studyInstanceTotal: studies.count()] ) 19 69 } 20 70 … … 43 93 } 44 94 else { 95 // Check whether the user may see this study 96 def loggedInUser = AuthenticationService.getLoggedInUser() 97 if( !studyInstance.canRead(loggedInUser) ) { 98 flash.message = "You have no access to this study" 99 redirect(action: "list") 100 } 101 45 102 // The study instance is packed into an array, to be able to 46 103 // use the same view for showing the study and comparing multiple 47 104 // studies 48 [studyList: [ studyInstance ], multipleStudies: false ]49 } 50 } 51 52 105 [studyList: [ studyInstance ], multipleStudies: false, loggedInUser: loggedInUser ] 106 } 107 } 108 109 def showByToken = { 53 110 def studyInstance = Study.findByCode(params.id) 54 111 if (!studyInstance) { … … 57 114 } 58 115 else { 116 // Check whether the user may see this study 117 def loggedInUser = AuthenticationService.getLoggedInUser() 118 if( !studyInstance.canRead(loggedInUser) ) { 119 flash.message = "You have no access to this study" 120 redirect(action: "list") 121 } 122 59 123 redirect(action: "show", id: studyInstance.id) 60 124 } -
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r959 r976 5 5 // Grails convertors is imported in order to create JSON objects 6 6 import grails.converters.* 7 import grails.plugins.springsecurity.Secured 8 import dbnp.authentication.AuthenticationService 9 import dbnp.authentication.SecUser 7 10 8 11 … … 12 15 * The wizard controller handles the handeling of pages and data flow 13 16 * through the study capturing wizard. 17 * 18 * This controller is only accessible by logged in users. 14 19 * 15 20 * @author Jeroen Wesbeek … … 22 27 * $Date$ 23 28 */ 29 @Secured(['IS_AUTHENTICATED_REMEMBERED']) 24 30 class WizardController { 31 def AuthenticationService 32 25 33 /** 26 34 * index method, redirect to the webflow … … 790 798 // save study 791 799 println ".saving study" 800 801 // Make sure the owner of the study is set right 802 flow.study.owner = AuthenticationService.getLoggedInUser() 803 792 804 if (!flow.study.save(flush:true)) { 793 805 this.appendErrors(flow.study, flash.errors) … … 846 858 try { 847 859 // load study 848 flow.study = (params.studyid) ? Study.findById( params.studyid ) : Study.findByTitle( params.study ) 849 860 def study = (params.studyid) ? Study.findById( params.studyid ) : Study.findByTitle( params.study ) 861 862 // Check whether the user is allowed to edit this study. If it is not allowed 863 // the used should had never seen a link to this page, so he should never get 864 // here. That's why we just return false 865 if( !study.canWrite(AuthenticationService.getLoggedInUser()) ) { 866 return false; 867 } 868 869 flow.study = study 850 870 // set 'quicksave' variable 851 871 flow.quickSave = true … … 903 923 // handle contacts 904 924 handleContacts(flow, flash, params) 925 926 // handle users (readers, writers) 927 handleUsers(flow, flash, params, 'readers') 928 handleUsers(flow, flash, params, 'writers') 929 930 // handle public checkbox 931 if( params.get( "publicstudy" ) ) { 932 flow.study.publicstudy = params.get( "publicstudy" ) 933 } 905 934 906 935 // validate the study … … 1016 1045 1017 1046 } 1047 1048 /** 1049 * re-usable code for handling contacts form data in a web flow 1050 * @param Map LocalAttributeMap (the flow scope) 1051 * @param Map localAttributeMap (the flash scope) 1052 * @param Map GrailsParameterMap (the flow parameters = form data) 1053 * @param String 'readers' or 'writers' 1054 * @return boolean 1055 */ 1056 def handleUsers(flow, flash, params, type) { 1057 def users = [] 1058 1059 if( type == "readers" ) { 1060 users = flow.study.readers ?: [] 1061 } else if( type == "writers" ) { 1062 users = flow.study.writers ?: [] 1063 } 1064 1065 // Check the ids of the contacts that should be attached 1066 // to this study. If they are already attached, keep 'm. If 1067 // studies are attached that are not in the selected (i.e. the 1068 // user deleted them), remove them 1069 1070 // Users are saved as user_id 1071 def userIDs = params.get( type + '_ids') 1072 if (userIDs) { 1073 // Find the individual IDs and make integers 1074 userIDs = userIDs.split(',').collect { Integer.parseInt(it, 10) } 1075 1076 // First remove the publication that are not present in the array 1077 users.removeAll { user -> !userIDs.find { id -> id == user.id } } 1078 1079 // Add those publications not yet present in the database 1080 userIDs.each { id -> 1081 if (!users.find { user -> id == user.id }) { 1082 def user = SecUser.get(id) 1083 if (user) { 1084 users.add(user) 1085 } else { 1086 println('.user with ID ' + id + ' not found in database.') 1087 } 1088 } 1089 } 1090 1091 } else { 1092 println('.no users selected.') 1093 users.clear() 1094 } 1095 1096 if( type == "readers" ) { 1097 if( flow.study.readers ) 1098 flow.study.readers.clear() 1099 users.each { flow.study.addToReaders( it ) } 1100 } else if( type == "writers" ) { 1101 if( flow.study.writers ) 1102 flow.study.writers.clear() 1103 1104 users.each { flow.study.addToWriters( it ) } 1105 } 1106 1107 } 1018 1108 1019 1109 /** -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r974 r976 1 1 package dbnp.studycapturing 2 2 3 import org.nmcdsp.plugins.aaaa.SecUser3 import dbnp.authentication.SecUser 4 4 5 5 /** … … 12 12 */ 13 13 class Study extends TemplateEntity { 14 15 16 }14 static searchable = { 15 [only: ['title', 'Description']] // the description field will be searched only if defined in a study template 16 } 17 17 18 18 SecUser owner // The owner of the study. A new study is automatically owned by its creator. … … 29 29 List assays 30 30 boolean published = false // Determines whether a study is private (only accessable by the owner and writers) or published (also visible to readers) 31 31 boolean publicstudy = false // Determines whether anonymous users are allowed to see this study. This has only effect when published = true 32 32 33 static hasMany = [ 33 34 subjects: Subject, … … 38 39 assays: Assay, 39 40 persons: StudyPerson, 40 publications: Publication 41 publications: Publication, 42 readers: SecUser, 43 writers: SecUser 41 44 ] 42 45 … … 54 57 // Workaround for bug http://jira.codehaus.org/browse/GRAILS-6754 55 58 templateTextFields type: 'text' 56 owner column: "studyowner"57 title column: "studytitle"58 code column: "studycode"59 subjects column: "studysubjects"60 events column: "studyevents"61 samplingEvents column: "studysamplingevents"62 eventGroups column: "studyeventgroups"63 samples column: "studysamples"64 assays column: "studyassays"65 59 } 66 60 … … 407 401 return msg 408 402 } 403 404 /** 405 * Returns true if the given user is allowed to read this study 406 */ 407 public boolean canRead(SecUser loggedInUser) { 408 // Anonymous readers are only given access when published and public 409 if( loggedInUser == null ) { 410 return this.publicstudy && this.published; 411 } 412 413 // Owners and writers are allowed to read this study 414 if( this.owner == loggedInUser || this.writers.contains(loggedInUser) ) { 415 return true 416 } 417 418 // Readers are allowed to read this study when it is published 419 if( this.readers.contains(loggedInUser) && this.published ) { 420 return true 421 } 422 423 return false 424 } 425 426 /** 427 * Returns true if the given user is allowed to write this study 428 */ 429 public boolean canWrite(SecUser loggedInUser) { 430 if( loggedInUser == null ) { 431 return false; 432 } 433 return this.owner == loggedInUser || this.writers.contains(loggedInUser) 434 } 435 436 /** 437 * Returns true if the given user is the owner of this study 438 */ 439 public boolean isOwner(SecUser loggedInUser) { 440 if( loggedInUser == null ) { 441 return false; 442 } 443 return this.owner == loggedInUser 444 } 445 409 446 } -
trunk/grails-app/domain/dbnp/studycapturing/Template.groovy
r961 r976 1 1 package dbnp.studycapturing 2 2 3 import org.nmcdsp.plugins.aaaa.SecUser3 import dbnp.authentication.SecUser 4 4 5 5 /** … … 39 39 40 40 static mapping = { 41 name column:"templatename"42 description column:"templatedescription"43 entity column:"templateentity"44 owner column:"templateowner"45 fields column:"templatefields"46 41 } 47 42 -
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r961 r976 70 70 // Make sure that the text fields are really stored as TEXT, so that those Strings can have an arbitrary length. 71 71 templateTextFields type: 'text' 72 73 template column:"templateentitytemplate"74 72 } 75 73 -
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r959 r976 3 3 import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib 4 4 import dbnp.studycapturing.* 5 import dbnp.authentication.SecUser 5 6 import dbnp.data.* 6 7 import cr.co.arquetipos.crypto.Blowfish … … 19 20 */ 20 21 class WizardTagLib extends JavascriptTagLib { 22 23 def AuthenticationService 24 21 25 // define the tag namespace (e.g.: <wizard:action ... /> 22 26 static namespace = "wizard" … … 649 653 */ 650 654 def studySelect = { attrs -> 651 // for now, just fetch all studies 652 attrs.from = Study.findAll() 655 // Find all studies the user has access to 656 def user = AuthenticationService.getLoggedInUser() 657 658 def c = Study.createCriteria() 659 attrs.from = c.list { 660 or { 661 eq( "owner", user ) 662 writers { 663 eq( "id", user.id ) 664 } 665 } 666 } 653 667 654 668 // got a name? … … 1311 1325 out << "Role: " + select(selectAttrs) 1312 1326 } 1327 1328 1329 def UserSelectElement = { attrs, body -> 1330 // render list with publications currently available 1331 baseElement.call( 1332 '_userList', 1333 attrs, 1334 body 1335 ) 1336 1337 attrs.description = ''; 1338 1339 // render 'Add user button' 1340 baseElement.call( 1341 '_userAddButton', 1342 attrs, 1343 body 1344 ) 1345 } 1346 1347 /** 1348 * Renders an input box for publications 1349 */ 1350 def userSelect = { attrs, body -> 1351 if (attrs.get('value') == null) { 1352 attrs.value = []; 1353 } 1354 if (attrs.get('description') == null) { 1355 attrs.description = ''; 1356 } 1357 1358 out << '<form id="' + attrs.name + '_form" onSubmit="return false;">'; 1359 out << select( 1360 name: attrs.get("name"), 1361 value: '', 1362 from: SecUser.list(), 1363 optionValue: 'username', 1364 optionKey: 'id', 1365 style: 'width: 400px;' 1366 ); 1367 out << '</form>'; 1368 } 1369 1370 def _userList = { attrs, body -> 1371 def display_none = 'none'; 1372 if (!attrs.get('value') || attrs.get('value').size() == 0) { 1373 display_none = 'inline'; 1374 } 1375 1376 // Add a unordered list 1377 out << '<ul class="user_list" id="' + attrs.name + '_list">'; 1378 1379 out << '<li>'; 1380 out << '<span class="user_none" id="' + attrs.name + '_none" style="display: ' + display_none + ';">'; 1381 out << '-'; 1382 out << '</span>'; 1383 out << '</li>'; 1384 1385 out << '</ul>'; 1386 1387 // Add the publications using javascript 1388 out << '<script type="text/javascript">' 1389 if (attrs.get('value') && attrs.get('value').size() > 0) { 1390 def i = 0; 1391 attrs.get('value').each { 1392 out << 'showUser( '; 1393 out << ' "' + attrs.name + '",'; 1394 out << ' ' + it.id + ','; 1395 out << ' "' + it.username + '",'; 1396 out << ' ' + i++; 1397 out << ');'; 1398 } 1399 } 1400 out << '</script>'; 1401 1402 def ids; 1403 if (attrs.get('value') && attrs.get('value').size() > 0) { 1404 ids = attrs.get('value').id.join(',') 1405 } else { 1406 ids = ''; 1407 } 1408 out << '<input type="hidden" name="' + attrs.name + '_ids" value="' + ids + '" id="' + attrs.name + '_ids">'; 1409 } 1410 1411 def _userAddButton = { attrs, body -> 1412 1413 // Output the dialog for the publications 1414 out << '<div id="' + attrs.name + '_dialog">'; 1415 out << '<p>Select a user from the database.</p>'; 1416 out << userSelect(attrs, body); 1417 out << '</div>'; 1418 out << '<script type="text/javascript">'; 1419 out << ' createUserDialog( "' + attrs.name + '" );' 1420 out << '</script>'; 1421 1422 out << '<input type="button" onClick="openUserDialog(\'' + attrs.name + '\' );" value="Add User">'; 1423 } 1424 1313 1425 } -
trunk/grails-app/views/common/_login_panel.gsp
r959 r976 14 14 <h1>Member Login</h1> 15 15 <label class="grey" for="username">Username:</label> 16 <input class="field" type="text" name="j_username" id=" username" value="${username}" size="23" />16 <input class="field" type="text" name="j_username" id="j_username" value="${username}" size="23" /> 17 17 <label class="grey" for="password">Password:</label> 18 18 <input class="field" type="password" name="j_password" id="password" size="23" /> 19 <label><input type='checkbox' class='chk' name=' ${rememberMeParameter}' id='remember_me'20 <g:if test='${hasCookie}'>checked='checked'</g:if> /> </label>21 19 <label><input type='checkbox' class='chk' name='_spring_security_remember_me' id='remember_me' 20 <g:if test='${hasCookie}'>checked='checked'</g:if> /> Remember me</label> 21 <div class="clear"></div> 22 22 <input type="submit" name="submit" value="Login" class="bt_login" /> 23 <a class="lost-pwd" href="<g:createLink url="[action:' passwordReminder',controller:'auth']" class="lost-pwd" />">Lost your password?</a>23 <a class="lost-pwd" href="<g:createLink url="[action:'forgotPassword',controller:'register']" class="lost-pwd" />">Lost your password?</a> 24 24 </g:form> 25 25 </div> 26 26 <div class="left right"> 27 <g:form url="[action:'signUp',controller:'auth']" class="clearfix">27 <g:form url="[action:'add',controller:'userRegistration']" class="clearfix"> 28 28 <input type="hidden" name="targetUri" value="${targetUri}" /> 29 29 <h1>Not a member yet? Sign Up!</h1> 30 30 <label class="grey" for="signup">Username:</label> 31 <input class="field" type="text" name=" signup" id="signup" value="${username}" size="23" />31 <input class="field" type="text" name="username" id="username" value="${username}" size="23" /> 32 32 <label class="grey" for="email">Email:</label> 33 33 <input class="field" type="text" name="email" id="email" value="${email}" size="23" /> 34 <label>A password will be e-mailed to you.</label> 34 <label>A password will be e-mailed to you</label> 35 35 36 <input type="submit" name="submit" value="Register" class="bt_register" /> 36 37 </g:form> 37 38 </div> 38 39 </div> … … 41 42 <ul class="login"> 42 43 <li class="left"> </li> 43 <li>Hello < authentication:isLoggedIn><authentication:loggedInUsername/></authentication:isLoggedIn>44 < authentication:isNotLoggedIn>Guest</authentication:isNotLoggedIn>!</li>44 <li>Hello <sec:ifLoggedIn><sec:username/></sec:ifLoggedIn> 45 <sec:ifNotLoggedIn>Guest</sec:ifNotLoggedIn>!</li> 45 46 <li class="sep">|</li> 46 47 <li id="toggle"> 47 < authentication:isLoggedIn><g:link controller="logout" action="index">sign out</g:link></authentication:isLoggedIn>48 <authentication:isNotLoggedIn>49 50 51 </authentication:isNotLoggedIn>48 <sec:ifLoggedIn><g:link controller="logout" action="index">sign out</g:link></sec:ifLoggedIn> 49 <sec:ifNotLoggedIn> 50 <a id="open" class="open" href="#">Log In | Register</a> 51 <a id="close" style="display: none;" class="close" href="#">Close Panel</a> 52 </sec:ifNotLoggedIn> 52 53 </li> 53 54 <li class="right"> </li> -
trunk/grails-app/views/common/_topnav.gsp
r959 r976 3 3 <ul class="topnav"> 4 4 <li><g:link controller="home" action="index">Home</g:link></li> 5 < n:isLoggedIn>6 <li><g:link controller="study" action=" list">My studies</g:link></li>7 </ n:isLoggedIn> <li>5 <sec:ifLoggedIn> 6 <li><g:link controller="study" action="myStudies">My studies</g:link></li> 7 </sec:ifLoggedIn> <li> 8 8 <a href="#">Studies</a> 9 9 <ul class="subnav"> … … 38 38 </li> 39 39 </g:if> 40 <n:isAdministrator>40 <sec:ifAllGranted roles="ROLE_ADMIN"> 41 41 <li> 42 42 <a href="#">User administation</a> 43 43 <ul class="subnav"> 44 <li><g:link controller="admins" action="index" class="icon icon_user_suit">Manage Administrators</g:link></li> 45 <li><g:link controller="user" action="list" class="icon icon_user">List Users</g:link></li> 44 <li><g:link controller="user" class="icon icon_user">List Users</g:link></li> 46 45 <li><g:link controller="user" action="create" class="icon icon_user_add">Create User</g:link></li> 47 <li><g:link controller="role" action="list"class="icon icon_cog">List Roles</g:link></li>46 <li><g:link controller="role" class="icon icon_cog">List Roles</g:link></li> 48 47 <li><g:link controller="role" action="create" class="icon icon_cog_add">Create Role</g:link></li> 49 <li><g:link controller="group" action="list" class="icon icon_group">List Groups</g:link></li> 50 <li><g:link controller="group" action="create" class="icon icon_group_add">Create Group</g:link></li> 51 <li><g:link controller="auth" action="logout" class="icon icon_cross">Sign out</g:link></li> 48 <li><g:link controller="logout" class="icon icon_cross">Sign out</g:link></li> 52 49 </ul> 53 50 </li> 54 </n:isAdministrator>51 </sec:ifAllGranted> 55 52 </ul> 56 53 <!-- /TOPNAV //--> -
trunk/grails-app/views/study/list.gsp
r959 r976 77 77 </div> 78 78 <div class="buttons"> 79 <span class="button"><g:link class="create" controller="wizard" params="[jump:'create']"><g:message code="default.new.label" args="[entityName]" /></g:link></span> 79 <sec:ifLoggedIn> 80 <span class="button"><g:link class="create" controller="wizard" params="[jump:'create']"><g:message code="default.new.label" args="[entityName]" /></g:link></span> 81 </sec:ifLoggedIn> 80 82 </div> 81 83 <div class="paginateButtons"> -
trunk/grails-app/views/study/show.gsp
r968 r976 273 273 </g:each> 274 274 </tr> 275 <tr>276 <td>Owner</td>277 <g:each in="${studyList}" var="studyInstance">278 <td>279 <g:if test="${studyInstance.owner}">280 <g:link controller="user" action="show" id="${studyInstance.owner.id}">${studyInstance.owner?.encodeAsHTML()}</g:link>281 </g:if>282 <g:else>283 -284 </g:else>285 </td>286 </g:each>287 </tr>288 275 <tr> 289 <td> Members</td>276 <td>Public</td> 290 277 <g:each in="${studyList}" var="studyInstance"> 291 278 <td> 292 <% /* <g:if test="${studyInstance.getAllMemberUsers()==0}"> 279 ${studyInstance.publicstudy} 280 </td> 281 </g:each> 282 </tr> 283 <tr> 284 <td>Owner</td> 285 <g:each in="${studyList}" var="studyInstance"> 286 <td> 287 ${studyInstance.owner.username} 288 </td> 289 </g:each> 290 </tr> 291 <tr> 292 <td>Readers</td> 293 <g:each in="${studyList}" var="studyInstance"> 294 <td> 295 <g:if test="${studyInstance.readers.size() == 0}"> 293 296 - 294 297 </g:if> 295 298 <g:else> 296 <g:each in="${studyInstance.getAllMemberUsers()}" var="memberuser" status="i"> 297 <g:if test="${i > 0}">, </g:if> 298 <g:link controller="user" action="show" id="${memberuser.id}">${memberuser?.encodeAsHTML()}</g:link> 299 </g:each> 299 ${studyInstance.readers.username.join( ", " )} 300 300 </g:else> 301 */ %> 301 </td> 302 </g:each> 303 </tr> 304 <tr> 305 <td>Writers</td> 306 <g:each in="${studyList}" var="studyInstance"> 307 <td> 308 <g:if test="${studyInstance.writers.size()==0}"> 309 - 310 </g:if> 311 <g:else> 312 ${studyInstance.writers.username.join( ", " )} 313 </g:else> 302 314 </td> 303 315 </g:each> … … 845 857 <g:set var="studyInstance" value="${studyList[0]}" /> 846 858 <g:hiddenField name="id" value="${studyInstance?.id}" /> 847 <span class="button"><g:link class="edit" controller="wizard" params="[jump:'edit']" id="${studyInstance?.id}">${message(code: 'default.button.edit.label', default: 'Edit')}</g:link></span> 848 <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span> 849 </g:if> 859 <g:if test="${studyInstance.canWrite(loggedInUser)}"> 860 <span class="button"><g:link class="edit" controller="wizard" params="[jump:'edit']" id="${studyInstance?.id}">${message(code: 'default.button.edit.label', default: 'Edit')}</g:link></span> 861 </g:if> 862 <g:if test="${studyInstance.isOwner(loggedInUser)}"> 863 <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span> 864 </g:if> 865 </g:if> 850 866 <span class="button"><g:link class="backToList" action="list">Back to list</g:link></span> 851 867 </g:form> -
trunk/grails-app/views/wizard/pages/_study.gsp
r959 r976 31 31 <wizard:publicationSelectElement name="publication" value="${study?.publications}" /> 32 32 <wizard:contactSelectElement name="contacts" value="${study?.persons}" /> 33 </g:if> 33 34 <br /> 35 <div class="element"> 36 <div class="description">Public </div> 37 <div class="input"><g:checkBox name="publicstudy" value="${study?.publicstudy}" /></div> 38 </div> 39 40 <wizard:userSelectElement name="readers" description="Readers" value="${study?.readers}" /> 41 <wizard:userSelectElement name="writers" description="Writers" value="${study?.writers}" /> 42 43 </g:if> 34 44 35 45 </wizard:pageContent>
Note: See TracChangeset
for help on using the changeset viewer.