Ignore:
Timestamp:
Nov 9, 2009, 2:04:00 PM (14 years ago)
Author:
keesvb
Message:

Added fix for postgres problems, refactored JQuery code in tag library

File:
1 edited

Legend:

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

    r53 r54  
    4646
    4747    // Execute any custom Nimble related BootStrap for your application below
     48    if (nimble.User.count() == 0) {
    4849
    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
     50        // Create example User account
     51        def user = InstanceGenerator.user()
     52        user.username = "user"
     53        user.pass = 'useR123!'
     54        user.passConfirm = 'useR123!'
     55        user.enabled = true
    5556
    56     def userProfile = InstanceGenerator.profile()
    57     userProfile.fullName = "Test User"
    58     userProfile.owner = user
    59     user.profile = userProfile
     57        def userProfile = InstanceGenerator.profile()
     58        userProfile.fullName = "Test User"
     59        userProfile.owner = user
     60        user.profile = userProfile
    6061
    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")
     62        def savedUser = userService.createUser(user)
     63        if (savedUser.hasErrors()) {
     64          savedUser.errors.each {
     65            log.error(it)
     66          }
     67          throw new RuntimeException("Error creating example user")
     68        }
     69
     70        // Create example Administrative account
     71        def admins = Role.findByName(AdminsService.ADMIN_ROLE)
     72        def admin = InstanceGenerator.user()
     73        admin.username = "admin"
     74        admin.pass = "admiN123!"
     75        admin.passConfirm = "admiN123!"
     76        admin.enabled = true
     77
     78        def adminProfile = InstanceGenerator.profile()
     79        adminProfile.fullName = "Administrator"
     80        adminProfile.owner = admin
     81        admin.profile = adminProfile
     82
     83        def savedAdmin = userService.createUser(admin)
     84        if (savedAdmin.hasErrors()) {
     85          savedAdmin.errors.each {
     86            log.error(it)
     87          }
     88          throw new RuntimeException("Error creating administrator")
     89        }
     90
     91        adminsService.add(admin)
     92
    6793    }
    68 
    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)
    9194  }
    9295
Note: See TracChangeset for help on using the changeset viewer.