Skip to content

Instantly share code, notes, and snippets.

@tomaslin
Created July 19, 2012 22:10
Show Gist options
  • Save tomaslin/3147223 to your computer and use it in GitHub Desktop.
Save tomaslin/3147223 to your computer and use it in GitHub Desktop.
role defined previously
User.createCriteria().list(){
createAlias( 'userRole', 'ur' )
and{
eq( 'role', 'ur.role' )
eq( 'ur.role', role )
}
projections{
property("username")
}
}
@tednaleid
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment