Interface GroupsHandler

  • All Superinterfaces:
    BasicGroupListViewFactoryAccessor, GroupListViewFactoryAccessor
    All Known Subinterfaces:
    GroupsHandlerInternal
    All Known Implementing Classes:
    GroupsHandlerImpl

    public interface GroupsHandler
    extends GroupListViewFactoryAccessor
    The groups management involves the following concepts.
    Firstly, there are four distinguished group collections related to an user:
    • The groups in which an user can access other users
    • The groups in which an user can search for ads of other users
    • The groups in which an user can search for other users
    • The groups in which an user can search for other users on the directory map
    Secondly, all of those collections could include disabled groups or not. Disabled groups are only visible to admins.
    Finally, the user has associated a group visibility meaning how groups information is visible to regular users (members and brokers)

    This class is the starting point to work with all of those concepts.
    To get access to each collection including only enabled groups use: To get access to the visible groups according to the GroupVisibility associated to the user use visibles() as a way to get the correct factory accessor.
    If you need to include also the disabled groups (only for admins) then use all() for the right factory (we have support to include disabled groups only for the accessible collection)
    See Also:
    GroupListViewFactoryAccessor, GroupListViewFactory, GroupListView, GroupList
    • Method Detail

      • doFlatten

        static Set<? extends BasicGroup> doFlatten​(Collection<? extends BasicGroup> basicGroups,
                                                   boolean includeDisabled,
                                                   boolean includeGroupset)
        Expands the given groups / group sets into a set of groups / group sets (depending on a flag). Of each encountered groupSet, all the belonging groups are added.
        Parameters:
        basicGroups - a Collection which is the input list. This collection is copied to the result.
        includeDisabled - a boolean indicating that the disabled groups must be included. This only applies for groups which are included via their GroupSet; any disabled group explicitly included in the input is always included in the output.
        includeGroupset - a boolean indicating if a GroupSet itself must be included. Members Groups belonging to the GroupSet are always included; the GroupSet itself is only included if this parameter is true.
      • all

        GroupListViewFactory all()
        Only for administrators or system it will include disabled groups, for members it returns the same as BasicGroupListViewFactoryAccessor.accessibles(). This method must be used if we want to include the disabled basic groups in the views returned by the factory. We directly return a factory because only the accessible groups has support to include disabled.
      • flatten

        Set<Group> flatten​(Collection<? extends BasicGroup> basicGroups)
        Expands the given groups / group sets into a set of groups. Of each encountered groupSet, all the belonging groups are added. The groupset itself is left out.
        Disabled groups are included if they are explicitly included in the input collection. If the disabled group belongs to a groupset, and this groupset is included in the input collection (without the disabled group itself being explicitly included), then the disabled group is NOT included in the result. So if you want to include any disabled group, be sure to add it explicitly in the input parameter.
      • flattenVOs

        Set<Group> flattenVOs​(Collection<? extends BasicGroupVO> basicGroupVOs,
                              boolean includeDisabledGroupsOfGroupset)
        See flatten(Collection), but takes the VO's as input, and includes disabled groups depending on the boolean parameter.
        Parameters:
        includeDisabledGroupsOfGroupset - boolean, if false, the behavior is as flattenVOs(Collection). If true, the disabled groups are included if they are part of a groupSet which is selected, no matter if they are explicitly selected or not.
      • getAccessibleGlobalGroups

        Set<AdminGroup> getAccessibleGlobalGroups()
        Returns the accessible admin global groups the logged user can access. If the logged user is not global then an empty set is returned. Otherwise, if it has the Role.GLOBAL_ADMIN role then returns all global groups, it not, returns a set containing its own group.
      • getAccessibleUserGroups

        Set<UserGroup> getAccessibleUserGroups​(User user)
        Returns the accessible groups with type=USER and enabled=true for the given user
      • getGroupVisibility

        GroupVisibility getGroupVisibility​(boolean overBrokered)
        Returns the GroupVisibility for the current user. As broker we must have the same or bigger visibility than as member, so when brokering, it is used as base-line the visibility set in member products.
      • getPossiblePublicInitialGroups

        List<InitialGroupVO> getPossiblePublicInitialGroups()
        Returns the groups either a public user may use to register himself, or a broker to register a new member
      • getPossibleRegistrationGroups

        Set<Group> getPossibleRegistrationGroups​(boolean onlyUserGroups,
                                                 boolean asMember)
        Returns the possible groups for registering new users for the logged user:
        • if admin: all visible groups if admin products allow registration (Permission.USERS_REGISTER).
        • if broker: depends on the flag asMember: if true then all groups for registration according to the member products, otherwise all groups for registration according to the broker products. In both cases the groups are filtered by the accessible groups.
        • if member / operator: then all groups for registration according to the member products filtered by the accessible groups.
        Parameters:
        onlyUserGroups - if true then only user groups will be returned.
        asMember - only used in case of the logged user is a broker.
      • getPossibleRegistrationInitialGroups

        List<InitialGroupVO> getPossibleRegistrationInitialGroups​(boolean asMember)
        Same as {@link #getPossibleRegistrationGroups(false, boolean)} but in case of a broker registering "as member" or a member the name and description are those set for registration.
      • getViewProfileOnGroups

        Set<BasicGroup> getViewProfileOnGroups()
        Returns the groups the logged user can view profile of users
      • viewFactory

        GroupListViewFactory viewFactory​(GroupList list)
        Returns a view factory for working with brokeredMembers = false and without applying group visibility.