Created
April 26, 2017 18:22
-
-
Save AndrewShitsko/73b23869d8faf1d444041abed08f322a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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