Package org.cyclos.impl.users
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
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:BasicGroupListViewFactoryAccessor.accessibles()GroupListViewFactoryAccessor.ads()#users(boolean)#directory(boolean)
GroupVisibilityassociated to the user usevisibles()as a way to get the correct factory accessor.
If you need to include also the disabled groups (only for admins) then useall()for the right factory (we have support to include disabled groups only for the accessible collection)
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.collections4.BidiMap<Class<? extends BasicGroup>,Class<? extends BasicGroupVO>>VO_MAPPINGS
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description GroupListViewFactoryall()Only for administrators or system it will include disabled groups, for members it returns the same asBasicGroupListViewFactoryAccessor.accessibles().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).static Set<Group>doFlattenGroups(Collection<? extends BasicGroup> basicGroups, boolean includeDisabledGroups)Set<Group>flatten(Collection<? extends BasicGroup> basicGroups)Expands the given groups / group sets into a set of groups.Set<Group>flattenVOs(Collection<? extends BasicGroupVO> basicGroups)Seeflatten(Collection), but takes the VO's as input.Set<Group>flattenVOs(Collection<? extends BasicGroupVO> basicGroupVOs, boolean includeDisabledGroupsOfGroupset)Seeflatten(Collection), but takes the VO's as input, and includes disabled groups depending on the boolean parameter.Set<AdminGroup>getAccessibleGlobalGroups()Returns the accessible admin global groups the logged user can access.Set<UserGroup>getAccessibleUserGroups(User user)Returns the accessible groups with type=USER and enabled=true for the given userGroupVisibilitygetGroupVisibility(boolean overBrokered)Returns theGroupVisibilityfor the current user.List<InitialGroupVO>getPossiblePublicInitialGroups()Returns the groups either a public user may use to register himself, or a broker to register a new memberSet<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.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.Set<BasicGroup>getViewProfileOnGroups()Returns the groups the logged user can view profile of usersGroupListViewFactoryviewFactory(Collection<? extends BasicGroup> basicGroups)Return a view factory for the given set of basic groups.GroupListViewFactoryviewFactory(GroupList list)Returns a view factory for working with brokeredMembers = false and without applying group visibility.GroupListViewFactoryAccessorvisibles()This method must be used to send the available groups to use as filter (e.g in a search data) and must used in conjunction withGroupListView.check(Collection)to check the selected groups in the corresponding search.
It applies theGroupVisibilitybefore returning the groups (the other factory methods (BasicGroupListViewFactoryAccessor.accessibles(),GroupListViewFactoryAccessor.ads(), etc) don't).
For examples how to use it please search for references to this method.
Guests hasGroupVisibility.NONEas visibility then a factory returning empty views is returned (never null) and administrators hasGroupVisibility.GROUP.-
Methods inherited from interface org.cyclos.impl.users.BasicGroupListViewFactoryAccessor
accessibles
-
Methods inherited from interface org.cyclos.impl.users.GroupListViewFactoryAccessor
ads, directory, menu, users
-
-
-
-
Field Detail
-
VO_MAPPINGS
static final org.apache.commons.collections4.BidiMap<Class<? extends BasicGroup>,Class<? extends BasicGroupVO>> VO_MAPPINGS
-
-
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 extends BasicGroup> 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.
-
doFlattenGroups
static Set<Group> doFlattenGroups(Collection<? extends BasicGroup> basicGroups, boolean includeDisabledGroups)
-
all
GroupListViewFactory all()
Only for administrators or system it will include disabled groups, for members it returns the same asBasicGroupListViewFactoryAccessor.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> basicGroups)
Seeflatten(Collection), but takes the VO's as input.
-
flattenVOs
Set<Group> flattenVOs(Collection<? extends BasicGroupVO> basicGroupVOs, boolean includeDisabledGroupsOfGroupset)
Seeflatten(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 theRole.GLOBAL_ADMINrole 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 theGroupVisibilityfor 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(Collection<? extends BasicGroup> basicGroups)
Return a view factory for the given set of basic groups.
-
viewFactory
GroupListViewFactory viewFactory(GroupList list)
Returns a view factory for working with brokeredMembers = false and without applying group visibility.
-
visibles
GroupListViewFactoryAccessor visibles()
This method must be used to send the available groups to use as filter (e.g in a search data) and must used in conjunction withGroupListView.check(Collection)to check the selected groups in the corresponding search.
It applies theGroupVisibilitybefore returning the groups (the other factory methods (BasicGroupListViewFactoryAccessor.accessibles(),GroupListViewFactoryAccessor.ads(), etc) don't).
For examples how to use it please search for references to this method.
Guests hasGroupVisibility.NONEas visibility then a factory returning empty views is returned (never null) and administrators hasGroupVisibility.GROUP.
-
-