private Collection<JID> getAffectedUsers(Group group) {
        return getAffectedUsers(group, group.getSharedWith(), group.getSharedWithUsersInGroupNames());
    }
Returns all the users that are related to a shared group. This is the logic that we are
using: 1) If the group visibility is configured as "Everybody" then all users in the system or
all logged users in the system will be returned (configurable through the "filterOffline"
flag), 2) if the group visibility is configured as "onlyGroup" then all the group users will
be included in the answer and 3) if the group visibility is configured as "onlyGroup" and
the group allows other groups to include the group in the groups users' roster then all
the users of the allowed groups will be included in the answer.
xmppserver/src/main/java/org/jivesoftware/openfire/roster/RosterManager.java