Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.52 KB | None | 0 0
  1. import comingsoon.*
  2.  
  3. class BootStrap {
  4.  
  5.     def init = { servletContext ->
  6.        
  7.         def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority:'ROLE_ADMIN').save(insert:true,flush:true)
  8.         println adminRole
  9.        
  10.         if (User.count() == 0){
  11.             def admin = new User(username:'admin',password:'admin',enabled:true).save(flush:true,insert:true,failOnError:true)
  12.             println admin
  13.             def userRole = UserRole.create(admin,adminRole)
  14.             println userRole
  15.            
  16.             println admin
  17.         }
  18.     }
  19.     def destroy = {
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement