Return to Snippet

Revision: 12511
at March 17, 2009 20:13 by lucastex


Initial Code
class BootStrap {

     def authenticateService

     def init = { servletContext ->

	//Adding Roles
	def roleAdmin = new Role(authority:'ROLE_ADMIN', description:'App admin').save()
	def roleUser  = new Role(authority:'ROLE_USER', description:'App user').save()

	//Adding Users
	def userGod = new User(username:'god', 
				userRealName:'god almighty', 
				enabled: true,
				emailShow: true,
				email: '[email protected]',
				passwd: authenticateService.encodePassword('god')).save()

	def userSlave = new User(	username:'slave',
					userRealName:'poor slave',
					enabled: true,
					emailShow: true,
					email: '[email protected]',
					passwd: authenticateService.encodePassword('slave')).save()

	def secureUserEdit = new RequestMap(url: '/user/edit', configAttribute:'ROLE_ADMIN').save()
	def secureUserSave = new RequestMap(url: '/user/save', configAttribute:'ROLE_ADMIN').save()
	def secureUserCreate = new RequestMap(url: '/user/create', configAttribute:'ROLE_ADMIN').save()

	def secureUserList = new RequestMap(url: '/user/list', configAttribute:'ROLE_ADMIN, ROLE_USER').save()


	//Note that here we associate users with their respective roles
	roleAdmin.addToPeople(userGod)
	roleUser.addToPeople(userGod)
	roleUser.addToPeople(userSlave)

     }
     def destroy = {
     }
}

Initial URL

                                

Initial Description

                                

Initial Title
Final Bootstrap.groovy

Initial Tags
groovy

Initial Language
Groovy