Skip to content

Instantly share code, notes, and snippets.

@AndrewShitsko
Created April 26, 2017 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewShitsko/32c5a6f6d7ae4b52c7ef1a2c4961bcaf to your computer and use it in GitHub Desktop.
Save AndrewShitsko/32c5a6f6d7ae4b52c7ef1a2c4961bcaf to your computer and use it in GitHub Desktop.
package mock.transaction.manager
import grails.transaction.Transactional
@Transactional
class UserService {
def roleService
def createUser(Map params) {
def user = new User(params)
if (!user.save()) {
return null
}
roleService.grantRole(user, Role.findByAuthority(params.role))
user
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment