g.setSession(root); Set isMember = g.toMember().getMemberships();
Set isMember = new LinkedHashSet(); if (f.equals(Group.getDefaultList())) {   isMember = g.toMember().getMemberships(); }
  protected static Set doMemberOf(GrouperSession s, Group g, Member m)     throws GroupNotFoundException  {    // In order to bypass privilege constraints since a subject may be    // privileged to adjust memberships but not be privileged to see,    // let alone alter, all of the effective memberships that change as    // a result.    GrouperSession  root    = GrouperSessionFinder.getRootSession();    Set             mships  = new LinkedHashSet();    String          msg     = " for '" + g.getName() + "'/'" + m + "': ";    // Find where g is a member - but do it as root    g.setSession(root);      Set isMember = g.toMember().getMemberships();    // Add m to where g is a member - as root    Set temp0 = _findMembershipsWhereGroupIsMember(root, g, m, isMember);    mships.addAll(temp0);    GrouperLog.debug(LOG, s, "group is member" + msg + temp0.size());    // Add members of m to g - as root    // Add members of m to where g is a member - as root    mships.addAll(_findGroupAsMember(root, g.getUuid(), m, isMember));    // Now reset everything to the proper session    g.setSession(s);    Set resetMships = new LinkedHashSet();    // TODO Don't I already have a method to do this in bulk?    Iterator iter = mships.iterator();    while (iter.hasNext()) {      Membership ms = (Membership) iter.next();          ms.setSession(s);      resetMships.add(ms);    }    GrouperLog.debug(LOG, s, "memberOf total" + msg + resetMships.size());    return resetMships;  } // protected static Set doMemberOf(s, m)