3

How do I find groups a user belongs to? I can use GroupManager.findAllGroups() then loop the group with GroupManager.findUsersInGroup(java.lang.String groupName). However, this is expensive. Do we have any straight forward method?

Thanks.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Lee Chee Kiam
  • 11,450
  • 10
  • 65
  • 87
  • It depends on your database schema - if user table has a relation with groups, user.getGroups() should get you all the groups. – Raghuram Mar 02 '11 at 05:03
  • I am using default schema http://static.springsource.org/spring-security/site/docs/3.0.x/reference/appendix-schema.html – Lee Chee Kiam Jun 13 '11 at 14:14

1 Answers1

1

After some research, there is no existing Spring Security API to do it, you may need to write the SQL yourself based on your database schema.

Lee Chee Kiam
  • 11,450
  • 10
  • 65
  • 87