Changeset 5080


Ignore:
Timestamp:
Aug 27, 2009, 11:13:19 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1182: Groups with hidden members

Fixed a query problem when a user is not member of any groups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.13-stable/src/core/net/sf/basedb/core/Keyring.java

    r5077 r5080  
    511511        Set<Integer> projectGroups = Group.getGroupsRecursive(session, HibernateUtil.loadList(Integer.class, query, null));
    512512       
    513         // Finally, filter away groups that has hiddenMembers=true
    514         query = HibernateUtil.getPredefinedQuery(session, "GET_GROUPS_WITH_NONHIDDENMEMBERS");
    515         /*
    516           SELECT grp.id
    517           FROM GroupData grp
    518           WHERE grp.hiddenMembers = false
    519           AND grp.id IN (:groups)
    520         */
    521         query.setParameterList("groups", projectGroups, org.hibernate.Hibernate.INTEGER);
    522         projectGroups.retainAll(HibernateUtil.loadList(Integer.class, query, null));
     513        if (projectGroups.size() > 0)
     514        {
     515          // Finally, filter away groups that has hiddenMembers=true
     516          query = HibernateUtil.getPredefinedQuery(session, "GET_GROUPS_WITH_NONHIDDENMEMBERS");
     517          /*
     518            SELECT grp.id
     519            FROM GroupData grp
     520            WHERE grp.hiddenMembers = false
     521            AND grp.id IN (:groups)
     522          */
     523          query.setParameterList("groups", projectGroups, org.hibernate.Hibernate.INTEGER);
     524          projectGroups.retainAll(HibernateUtil.loadList(Integer.class, query, null));
     525        }
    523526       
    524527        // Load users that are members of the project groups
Note: See TracChangeset for help on using the changeset viewer.