Skip to Content
avatar image
Former Member

How to determine what groups a user belongs to?

The IRoleFactory has this handy method:

public java.lang.String[] getRolesOfUser(java.lang.String uniqueIdOfUser,
                                         boolean recursive)

However, the IGroupFactory has no similar method for fetching all the groups a user belongs to. Is there an easy way to do this?

I suppose I could get all groups, and remove the user from each one, but this isn't very efficient.

Is there a better way?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 15, 2008 at 09:24 PM

    In lieu of an answer, I ended up enumerating all the groups, and removing the user from the group if he/she was a member. Not especially efficient, but it works.

    FYI, you have to filter out the 'Everyone' and 'Authenticated Users' groups, since you can't remove users from these two groups. If you try, you'll get all sorts of warning and error messages in the logs.

    Add comment
    10|10000 characters needed characters exceeded