Created
July 19, 2012 22:10
-
-
Save tomaslin/3147223 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
role defined previously | |
User.createCriteria().list(){ | |
createAlias( 'userRole', 'ur' ) | |
and{ | |
eq( 'role', 'ur.role' ) | |
eq( 'ur.role', role ) | |
} | |
projections{ | |
property("username") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This unfortunately doesn't work because User doesn't have a
hasMany
relationship to UserRole, UserRole just has a User. This is with the spring security plugin, so the domain classes look basically like the ones in the spring security core plugin here: https://github.com/grails-plugins/grails-spring-security-core/tree/master/grails-app/domain/test