guys!
There are many Managers in one Organization. Manager – is a child of spring security SecUser class, that has many Authorities(in my case ‘buyer’,’seller’).
I`d like to find organizations that have at least one manager with authority ‘seller’
class Organization {
...
static hasMany = [managers:Manager]
}
class Manager extends SecUser{
...
Organization organization
}
class SecUser {
...
Set<SecRole> getAuthorities() {
SecUserSecRole.findAllBySecUser(this).collect { it.secRole } as Set
}
}
Criteria or hql – doesn`t matter. Thx in advance!
That’d be