Changeset 770 for trunk/grails-app/conf/NimbleBootStrap.groovy
- Timestamp:
- Aug 3, 2010, 2:00:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/NimbleBootStrap.groovy
r247 r770 1 1 /* 2 2 * Nimble, an extensive application base for Grails 3 * Copyright (C) 20 09 Intient Pty Ltd3 * Copyright (C) 2010 Bradley Beddoes 4 4 * 5 5 * Licensed under the Apache License, Version 2.0 (the "License"); … … 17 17 18 18 19 import intient.nimble.InstanceGenerator19 import grails.plugins.nimble.InstanceGenerator 20 20 21 import intient.nimble.domain.LevelPermission22 import intient.nimble.domain.Role23 import intient.nimble.domain.Group24 import intient.nimble.service.AdminsService25 import intient.nimble.service.UserService21 import grails.plugins.nimble.core.LevelPermission 22 import grails.plugins.nimble.core.Role 23 import grails.plugins.nimble.core.Group 24 import grails.plugins.nimble.core.AdminsService 25 import grails.plugins.nimble.core.UserService 26 26 27 27 /* … … 46 46 47 47 // Execute any custom Nimble related BootStrap for your application below 48 if (nimble.User.count() == 0) {49 println ".bootstrapping nimble"50 48 51 52 53 54 55 56 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 57 55 58 59 60 61 56 def userProfile = InstanceGenerator.profile() 57 userProfile.fullName = "Test User" 58 userProfile.owner = user 59 user.profile = userProfile 62 60 63 64 65 66 67 68 69 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") 67 } 70 68 71 72 73 74 75 76 77 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 78 76 79 80 81 82 77 def adminProfile = InstanceGenerator.profile() 78 adminProfile.fullName = "Administrator" 79 adminProfile.owner = admin 80 admin.profile = adminProfile 83 81 84 85 86 87 88 89 90 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 } 91 89 92 adminsService.add(admin) 93 94 } 90 adminsService.add(admin) 95 91 } 96 92
Note: See TracChangeset
for help on using the changeset viewer.