Ignore:
Timestamp:
Oct 29, 2009, 5:46:11 PM (13 years ago)
Author:
keesvb
Message:

changed study and experiment schema, added mysql production database

File:
1 edited

Legend:

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

    r37 r40  
    1616 */
    1717 
     18import org.codehaus.groovy.grails.commons.GrailsApplication
     19import grails.util.GrailsUtil
    1820
    1921import intient.nimble.InstanceGenerator
     
    4749    // Execute any custom Nimble related BootStrap for your application below
    4850
    49     // Create example User account
    50     def user = InstanceGenerator.user()
    51     user.username = "user"
    52     user.pass = 'useR123!'
    53     user.passConfirm = 'useR123!'
    54     user.enabled = true
     51    if ( GrailsUtil.getEnvironment().equals(GrailsApplication.ENV_DEVELOPMENT)) {
    5552
    56     def userProfile = InstanceGenerator.profile()
    57     userProfile.fullName = "Test User"
    58     userProfile.owner = user
    59     user.profile = userProfile
     53        // Create example User account
     54        def user = InstanceGenerator.user()
     55        user.username = "user"
     56        user.pass = 'useR123!'
     57        user.passConfirm = 'useR123!'
     58        user.enabled = true
    6059
    61     def savedUser = userService.createUser(user)
    62     if (savedUser.hasErrors()) {
    63       savedUser.errors.each {
    64         log.error(it)
    65       }
    66       throw new RuntimeException("Error creating example user")
     60        def userProfile = InstanceGenerator.profile()
     61        userProfile.fullName = "Test User"
     62        userProfile.owner = user
     63        user.profile = userProfile
     64
     65        def savedUser = userService.createUser(user)
     66        if (savedUser.hasErrors()) {
     67          savedUser.errors.each {
     68            log.error(it)
     69          }
     70          throw new RuntimeException("Error creating example user")
     71        }
     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
    6796    }
    6897
    69     // Create example Administrative account
    70     def admins = Role.findByName(AdminsService.ADMIN_ROLE)
    71     def admin = InstanceGenerator.user()
    72     admin.username = "admin"
    73     admin.pass = "admiN123!"
    74     admin.passConfirm = "admiN123!"
    75     admin.enabled = true
    76 
    77     def adminProfile = InstanceGenerator.profile()
    78     adminProfile.fullName = "Administrator"
    79     adminProfile.owner = admin
    80     admin.profile = adminProfile
    81 
    82     def savedAdmin = userService.createUser(admin)
    83     if (savedAdmin.hasErrors()) {
    84       savedAdmin.errors.each {
    85         log.error(it)
    86       }
    87       throw new RuntimeException("Error creating administrator")
    88     }
    89 
    90     adminsService.add(admin)
    9198  }
    9299
Note: See TracChangeset for help on using the changeset viewer.