Changeset 936 for trunk/grails-app
- Timestamp:
- Oct 11, 2010, 10:23:13 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 7 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r860 r936 6 6 import org.codehaus.groovy.grails.commons.GrailsApplication 7 7 import grails.util.GrailsUtil 8 import org.nmcdsp.plugins.aaaa.SecUser 8 9 9 // Imports for Nimble10 import grails.plugins.nimble.InstanceGenerator11 import grails.plugins.nimble.core.LevelPermission12 import grails.plugins.nimble.core.Role13 import grails.plugins.nimble.core.Group14 import grails.plugins.nimble.core.AdminsService15 import grails.plugins.nimble.core.UserService16 10 17 11 /** … … 26 20 */ 27 21 class BootStrap { 28 29 // Injections for Nimble 30 def grailsApplication 31 def nimbleService 32 def userService 33 def adminsService 22 def springSecurityService 34 23 35 24 def init = {servletContext -> … … 37 26 System.setProperty('user.timezone', 'CET') 38 27 39 // If there are no users yet in the database 40 println "Executing Nimble bootstrap..." 41 42 // The following must be executed 43 nimbleService.init() 44 45 // Add users 46 def user 47 48 if (dbnp.user.User.count() == 0) { 49 println "Adding example user..." 50 51 // Create example User account 52 user = InstanceGenerator.user() 53 user.username = "user" 54 user.pass = 'useR123!' 55 user.passConfirm = 'useR123!' 56 user.enabled = true 57 58 def userProfile = InstanceGenerator.profile() 59 userProfile.fullName = "Test User" 60 userProfile.owner = user 61 user.profile = userProfile 62 63 def savedUser = userService.createUser(user) 64 if (savedUser.hasErrors()) { 65 savedUser.errors.each { 66 log.error(it) 67 } 68 throw new RuntimeException("Error creating example user") 69 } 70 71 println "Adding example admin user..." 72 73 // Create example Administrative account 74 def admins = Role.findByName(AdminsService.ADMIN_ROLE) 75 def admin = InstanceGenerator.user() 76 admin.username = "admin" 77 admin.pass = "admiN123!" 78 admin.passConfirm = "admiN123!" 79 admin.enabled = true 80 81 def adminProfile = InstanceGenerator.profile() 82 adminProfile.fullName = "Administrator" 83 adminProfile.owner = admin 84 admin.profile = adminProfile 85 86 def savedAdmin = userService.createUser(admin) 87 if (savedAdmin.hasErrors()) { 88 savedAdmin.errors.each { 89 log.error(it) 90 } 91 throw new RuntimeException("Error creating administrator") 92 } 93 94 adminsService.add(admin) 95 } 96 else { 97 user = dbnp.user.User.findByUsername("user") 98 } 99 100 println "Done with Nimble bootstrap" 28 def user = SecUser.findByUsername('user') ?: new SecUser( 29 username: 'user', 30 password: springSecurityService.encodePassword('useR123!'), 31 enabled: true).save(failOnError: true) 32 33 println "Done with SpringSecurity bootstrap, created [user]." 101 34 102 35 // If there are no templates yet in the database -
trunk/grails-app/conf/BootStrapStudies.groovy
r882 r936 19 19 */ 20 20 21 public static void addExampleStudies( dbnp.user.User owner) {21 public static void addExampleStudies(org.nmcdsp.plugins.aaaa.SecUser owner) { 22 22 23 23 // Look up the used ontologies which should be in the database by now -
trunk/grails-app/conf/BuildConfig.groovy
r776 r936 18 18 */ 19 19 //grails.plugin.repos.discovery.intient = "http://intient.com/downloads/grails/" 20 return true; 20 grails.project.dependency.resolution = { 21 // inherit Grails' default dependencies 22 inherits("global") { 23 // uncomment to disable ehcache 24 // excludes 'ehcache' 25 } 26 log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' 27 repositories { 28 grailsPlugins() 29 grailsHome() 30 // mavenRepo "http://nmcdsp.org:8080/nexus-webapp-1.7.2/content/repositories/releases/" 31 mavenRepo "http://nexus.nmcdsp.org/content/repositories/releases" 32 grailsCentral() 33 34 // uncomment the below to enable remote dependency resolution 35 // from public Maven repositories 36 //mavenLocal() 37 //mavenCentral() 38 //mavenRepo "http://snapshots.repository.codehaus.org" 39 //mavenRepo "http://repository.codehaus.org" 40 //mavenRepo "http://download.java.net/maven/2/" 41 //mavenRepo "http://repository.jboss.com/maven2/" 42 } 43 dependencies { 44 // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. 45 46 // runtime 'mysql:mysql-connector-java:5.1.5' 47 } 48 } 49 50 //grails.plugin.location.'aaaa' = '/home/tjeerd/NetBeansProjects/nmcdsp/aaaa' -
trunk/grails-app/conf/Config.groovy
r931 r936 156 156 grails.views.javascript.library="jquery" 157 157 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' 162 158 163 // The OAuth consumer key and secret variables are currently replaced by Jeroen's Continuous Integration script. 159 164 // These keys were requested by me (Tjeerd) from myExperiment. -
trunk/grails-app/controllers/RestController.groovy
r935 r936 18 18 import dbnp.studycapturing.Study 19 19 import dbnp.studycapturing.Assay 20 import dbnp.user.User20 import org.nmcdsp.plugins.aaaa.SecUser 21 21 import grails.converters.* 22 22 import nl.metabolomicscentre.dsp.http.BasicAuthentication … … 34 34 def beforeInterceptor = [action:this.&auth,except:["isUser"]] 35 35 def credentials 36 def requestUser = User.findByName( "user" )36 def requestUser = SecUser.findByName( "user" ) 37 37 38 38 /** … … 66 66 boolean isUser 67 67 credentials = BasicAuthentication.credentialsFromRequest(request) 68 def reqUser = authService.authUser(credentials.u,credentials.p)68 //def reqUser = authService.authUser(credentials.u,credentials.p) 69 69 if (reqUser) { 70 70 isUser = true … … 317 317 */ 318 318 319 def getAuthorizationLevel = {319 /*def getAuthorizationLevel = { 320 320 321 321 isReader = false … … 350 350 if( study.owner.contains(user) ) isOwner = true 351 351 352 */352 353 353 354 354 render ['isReader':isOwner, 'isEditor':isEditor, 'isOwner':isOwner] as JSON 355 } 355 }*/ 356 356 357 357 -
trunk/grails-app/domain/dbnp/importer/MappingColumn.groovy
r784 r936 27 27 } 28 28 29 static mapping = { 30 tablePerHierarchy false 31 } 32 29 33 String toString() { 30 34 return "Name:" + name + "/TemplateFieldType:" + templatefieldtype + "/Entity:" + entity + "/Property:" + property + "/Index:" + index + "/Value:" + value + "/Identifier:" + identifier -
trunk/grails-app/domain/dbnp/studycapturing/Identity.groovy
r798 r936 1 1 package dbnp.studycapturing 2 3 import org.nmcdsp.plugins.aaaa.Entity 2 4 3 5 /** … … 41 43 * $Date$ 42 44 */ 43 abstract class Identity implements Serializable {45 abstract class Identity extends Entity implements Serializable { 44 46 // keep an internal identifier for use in dynamic forms 45 47 private int identifier = 0 -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r934 r936 1 1 package dbnp.studycapturing 2 2 3 import dbnp.user.User3 import org.nmcdsp.plugins.aaaa.SecUser 4 4 5 5 /** … … 16 16 } 17 17 18 User owner // The owner of the study. A new study is automatically owned by its creator.18 SecUser owner // The owner of the study. A new study is automatically owned by its creator. 19 19 String title // The title of the study 20 20 String code // currently used as the external study ID, e.g. to reference a study in a SAM module … … 22 22 Date lastUpdated 23 23 Date startDate 24 List subjects24 List subjects 25 25 List events 26 26 List samplingEvents … … 29 29 List assays 30 30 31 static hasMany = [ 32 editors: User, // Users with read/write access to the study 33 readers: User, // Users with only read access to the study 31 static hasMany = [ 34 32 subjects: Subject, 35 33 samplingEvents: SamplingEvent, … … 52 50 // Workaround for bug http://jira.codehaus.org/browse/GRAILS-6754 53 51 templateTextFields type: 'text' 52 owner column:"studyowner" 53 title column:"studytitle" 54 code column:"studycode" 55 subjects column:"studysubjects" 56 events column:"studyevents" 57 samplingEvents column:"studysamplingevents" 58 eventGroups column:"studyeventgroups" 59 samples column:"studysamples" 60 assays column:"studyassays" 54 61 55 62 } -
trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy
r874 r936 31 31 } 32 32 33 static mapping = { 34 name column:"subjectname" 35 } 36 33 37 34 38 /** -
trunk/grails-app/domain/dbnp/studycapturing/Template.groovy
r896 r936 1 1 package dbnp.studycapturing 2 2 3 import dbnp.user.User 3 import org.nmcdsp.plugins.aaaa.SecUser 4 import org.nmcdsp.plugins.aaaa.Entity 4 5 5 6 /** … … 31 32 32 33 /** The owner of the template. If the owner is not defined, it is a shared/public template */ 33 User owner34 SecUser owner 34 35 35 36 /** The template fields which are the members of this template. This is a List to preserve the field order */ … … 37 38 38 39 static hasMany = [fields: TemplateField] 40 41 static mapping = { 42 name column:"templatename" 43 description column:"templatedescription" 44 entity column:"templateentity" 45 owner column:"templateowner" 46 fields column:"templatefields" 47 } 39 48 40 49 // constraints -
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r902 r936 3 3 import dbnp.data.Term 4 4 import org.springframework.validation.FieldError 5 import org.nmcdsp.plugins.aaaa.Entity 5 6 6 7 /** … … 43 44 static hasMany = [ 44 45 templateStringFields : String, 45 templateTextFields 46 templateTextFields : String, 46 47 templateStringListFields: TemplateFieldListItem, 47 48 templateIntegerFields : int, 48 templateFloatFields 49 templateFloatFields : float, 49 50 templateDoubleFields : double, 50 templateDateFields 51 templateTermFields 51 templateDateFields : Date, 52 templateTermFields : Term, 52 53 templateRelTimeFields : long, 53 templateFileFields 54 templateFileFields : String, 54 55 templateBooleanFields : boolean, 55 56 templateTemplateFields : Template, 56 57 templateModuleFields : AssayModule, 57 templateLongFields 58 systemFields 58 templateLongFields : long, 59 systemFields : TemplateField 59 60 ] 60 61 … … 70 71 // Make sure that the text fields are really stored as TEXT, so that those Strings can have an arbitrary length. 71 72 templateTextFields type: 'text' 73 74 template column:"templateentitytemplate" 72 75 } 73 76 -
trunk/grails-app/domain/dbnp/studycapturing/TemplateField.groovy
r803 r936 72 72 // Make sure the comments can be Strings of arbitrary length 73 73 comment type: 'text' 74 name column:"templatefieldname" 75 type column:"templatefieldtype" 76 entity column:"templatefieldentity" 77 unit column:"templatefieldunit" 78 comment column:"templatefieldcomment" 74 79 } 75 80 -
trunk/grails-app/domain/dbnp/studycapturing/TemplateFieldListItem.groovy
r784 r936 20 20 } 21 21 22 static mapping = { 23 name column:"templatefieldlistitemname" 24 } 25 22 26 String toString() { 23 27 return name; -
trunk/grails-app/views/common/_login_panel.gsp
r611 r936 4 4 <div class="content clearfix"> 5 5 <div class="left"> 6 <h1>Welcome to the Generic Study Capture Framework</h1>6 <h1>Welcome to the Metabolomics Data Support Platform</h1> 7 7 <h2>version <b>${meta(name: 'app.version')}</b></h2> 8 8 <p class="grey">Please use the forms on the right to either log in if you already have an account, or sign up if you think this data support platform suits your needs.</p> … … 11 11 </div> 12 12 <div class="left"> 13 <g:form url="[action:'signin',controller:'auth']" class="clearfix"> 14 <input type="hidden" name="targetUri" value="${targetUri}" /> 13 <g:form controller="." action="j_spring_security_check" method='POST' class="clearfix"> 15 14 <h1>Member Login</h1> 16 15 <label class="grey" for="username">Username:</label> 17 <input class="field" type="text" name=" username" id="username" value="${username}" size="23" />16 <input class="field" type="text" name="j_username" id="username" value="${username}" size="23" /> 18 17 <label class="grey" for="password">Password:</label> 19 <input class="field" type="password" name="password" id="password" size="23" /> 20 <label><g:checkBox name="rememberMe" value="${rememberMe}" /> Remember me</label> 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 21 <div class="clear"></div> 22 22 <input type="submit" name="submit" value="Login" class="bt_login" /> … … 24 24 </g:form> 25 25 </div> 26 <div class="left right"> 26 <div class="left right"> 27 27 <g:form url="[action:'signUp',controller:'auth']" class="clearfix"> 28 28 <input type="hidden" name="targetUri" value="${targetUri}" /> 29 <h1>Not a member yet? Sign Up!</h1> 29 <h1>Not a member yet? Sign Up!</h1> 30 30 <label class="grey" for="signup">Username:</label> 31 31 <input class="field" type="text" name="signup" id="signup" value="${username}" size="23" /> … … 40 40 <div class="tab"> 41 41 <ul class="login"> 42 <li class="left"> </li> 43 <li>Hello <n:isLoggedIn><n:principal/></n:isLoggedIn><n:isNotLoggedIn>Guest</n:isNotLoggedIn>!</li> 42 <li class="left"> </li> 43 <% /* <li>Hello <authentication:isLoggedIn><authentication:loggedInUsername/></authentication:isLoggedIn> 44 <authentication:isNotLoggedIn>Guest</authentication:isNotLoggedIn>!</li> 44 45 <li class="sep">|</li> 45 46 <li id="toggle"> 46 <n:isLoggedIn><g:link controller="auth" action="signout">sign out</g:link></n:isLoggedIn>47 < n:isNotLoggedIn>47 <authentication:isLoggedIn><g:link controller="logout" action="index">sign out</g:link></authentication:isLoggedIn> 48 <authentication:isNotLoggedIn> 48 49 <a id="open" class="open" href="#">Log In | Register</a> 49 <a id="close" style="display: none;" class="close" href="#">Close Panel</a> 50 </n:isNotLoggedIn>51 </li> 50 <a id="close" style="display: none;" class="close" href="#">Close Panel</a> 51 </authentication:isNotLoggedIn> 52 </li>*/ %> 52 53 <li class="right"> </li> 53 </ul> 54 </div> 55 </div> 54 </ul> 55 </div> 56 </div> 56 57 <!-- /LOGIN PANEL --> -
trunk/grails-app/views/study/show.gsp
r899 r936 287 287 </tr> 288 288 <tr> 289 <td> Readers</td>289 <td>Members <permissions:manage entity="${studyList[0]}">manage</permissions:manage></td> 290 290 <g:each in="${studyList}" var="studyInstance"> 291 291 <td> 292 <g:if test="${studyInstance. readers?.size()==0}">292 <g:if test="${studyInstance.getAllMemberUsers()==0}"> 293 293 - 294 294 </g:if> 295 295 <g:else> 296 <g:each in="${studyInstance. readers}" var="r" status="i">296 <g:each in="${studyInstance.getAllMemberUsers()}" var="memberuser" status="i"> 297 297 <g:if test="${i > 0}">, </g:if> 298 <g:link controller="user" action="show" id="${ r.id}">${r?.encodeAsHTML()}</g:link>298 <g:link controller="user" action="show" id="${memberuser.id}">${memberuser?.encodeAsHTML()}</g:link> 299 299 </g:each> 300 300 </g:else> … … 302 302 </g:each> 303 303 </tr> 304 <tr>305 <td>Editors</td>306 <g:each in="${studyList}" var="studyInstance">307 <td>308 <g:if test="${studyInstance.editors?.size()==0}">309 -310 </g:if>311 <g:else>312 <g:each in="${studyInstance.editors}" var="r" status="i">313 <g:if test="${i > 0}">, </g:if>314 <g:link controller="user" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link>315 </g:each>316 </g:else>317 </td>318 </g:each>319 </tr>320 321 304 </table> 322 305 </div>
Note: See TracChangeset
for help on using the changeset viewer.