Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package mock.transaction.manager
import grails.transaction.Transactional
@Transactional
class RoleService {
def grantRole(User user, Role role) {
def userRoleInstance = new UserRole(user: user, role: role)
userRoleInstance.save()
}
def revokeRole(User u, Role r) {
if (u != null && r != null) {
UserRole.where { user == u && role == r }.deleteAll()
}
}
def revokeRoles(User u) {
u == null ? 0 : UserRole.where { user == u }.deleteAll()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment