Package org.cyclos.impl.users
Interface ProfileFieldHandler
-
public interface ProfileFieldHandlerHandler interface for profile fields permissions, which come from products
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_OVER_BROKERED_USERSAttribute name for scripting: Whether the search is being done over brokered users or general search (only for brokers)static StringATTR_SEARCH_CONTEXTAttribute name for scripting: The search context in which user profile fields are being used
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanEditProfile(BasicUser basicUser)Returns whether the logged user can edit the profile of the given user (i.e can edit / manage privacy of at least one if its profile fields).booleancanViewHidden(BasicUser user)Returns whether the logged user can view hidden fields of the given userbooleanenablePrivacy(BasicUser user)Returns whether the given user can have private profile fields.voidfill(DataWithBasicProfileFields data)Fills properties in search data with basic profile fieldsvoidfilterEnabledForUser(BasicUser user, BooleanPropertiesHolder<ProfileField> holder)Removes from the given BooleanPropertiesHolder all profile fields which are not enabled for the given userList<AddressQueryField>getAddressQueryFields()Returns the enabled address fields according to the current configurationList<ProfileField>getAllProfileFields()List<ProfileField>getAllProfileFieldsForOperators()Returns all profile fields that apply for operatorsList<UserCustomField>getCustomFields(Collection<? extends ProfileField> profileFields)Returns a list containing only the custom fields from the list of profile fieldsList<ProfileField>getEnabledProfileFields(BasicUser user)Returns the list of profile fields that are enabled in the given userList<UserProfileFieldActions>getFieldActions(BasicUser user)Returns the enabled fields for the given user (and visible to the logged user) and the actions that the logged user can perform over them The contexts which can be used are: - Internal or public registration: the given user should be transient - The logged user is viewing other user's profile.Set<ProfileFieldAction>getFieldActions(BasicUser user, ProfileField profileField)Returns the possible actions over the given user's profile fieldMap<ProfileField,Set<ProfileFieldAction>>getFieldActionsMap(BasicUser user)Returns, per profile field, the actions over fields of the given user by the logged userList<ProfileField>getFieldsByAction(BasicUser user, ProfileFieldAction action)Returns the profile fields which are enabled for the given action by the logged user over the given userFieldsContextgetFieldsContext(BasicUser user)Returns the context (or functionality) where the fields are being displayedList<ProfileField>getFieldsInMapResult(boolean overBrokeredUser)Returns the profile fields that are listed in the map resultsList<ProfileField>getFieldsInUserList(boolean overBrokeredUser)Returns the profile fields that are listed in the user listObjectgetFieldValue(BasicUser user, ProfileField profileField)Returns the value of the given profle field for the given user.List<ProfileField>getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, com.querydsl.core.types.dsl.BooleanPath path)LikegetMatchingFields(BooleanPropertiesHolder, Map), but using a single property which must be trueList<ProfileField>getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, com.querydsl.core.types.dsl.BooleanPath path, Boolean filter)LikegetMatchingFields(BooleanPropertiesHolder, Map), but using a single propertyList<ProfileField>getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, Map<com.querydsl.core.types.dsl.BooleanPath,Boolean> filter)Returns a list of the enabled profile fields that matches all the given filters in the map: for each map key, retains only fields whose that boolean flag is the same as the map value.UserPrincipalgetPrincipal(BasicUser basicUser, PrincipalType principalType)Returns the principal of the given principal type for the given user, making sure it applies to the user.UserPrincipalgetPrincipal(BasicUser basicUser, ChannelAccessAccessor channelAccess)Returns a principal the given user can use to access a channel with the given configurationProfileFieldgetProfileFieldFor(PrincipalType principalType)Returns the profile field corresponding to the given principal type, or null if not applicableList<ProfileField>getProfileFieldsForExport()Returns the visible profile fields that are enabled for exportList<ProfileField>getProfileFieldsInOperatorsList(User user)Returns the profile fields which are marked to be returned on the operator list.List<ProfileField>getSearchFilters(ProfileFieldSearchContext context, boolean searchOverBrokeredUsers, Map<String,Object> loadValuesScriptVariables)Returns the profile fields that can be used as filters in a search, according to the given context.Set<SendMedium>getSendMediums(BasicUser user)Returns the send mediums with corresponding profile fields enabled (and valid) for the given userPair<List<ProfileField>,List<ProfileField>>getSimpleAndAdvancedSearchFilters(ProfileFieldSearchContext context, boolean searchOverBrokeredUsers, Map<String,Object> loadValuesScriptVariables)Same asgetSearchFilters(ProfileFieldSearchContext, boolean, Map)but returns the filters separated by simple and advanced, which is defined in the products.ObjectgetSingleFieldValue(BasicUser user, ProfileField field)Similar togetFieldValue(BasicUser, ProfileField), except that never returns collections.List<ProductUserProfileFieldDTO>getUserProfileFields(ProductAccessor products)Returns the aggregate user profile fields for the given products accessor.List<ParameterVO>getUserVariables()Returns the list of available user variables.Function<String,String>getUserVariablesFunction(BasicUser user)Returns a function which maps variables to formatted values (i.e Strings) for the given user.List<ProfileField>getVisibleProfileFields(BasicUser user)Returns all profile fields which are both visible for the current user and enabled for the given userbooleanisAllowed(BasicUser user, ProfileField profileField, ProfileFieldAction action)Returns whether the given action is allowed for the given field / userbooleanisAllowedForOperator(ProfileField profileField)Returns whether the given profile field can be used for operatorsbooleanisDefaultHidden(Group group, ProfileField profileField)Returns whether the given field is marked as hidden for the given group configuration.booleanisEnabled(BasicUser user, ProfileField profileField)Returns whether the given profile field is enabled for the given products accessorbooleanisHidden(BasicUser user, ProfileField profileField, Object value)Returns whether the given field is marked as hidden for the given user.booleanisVisible(ProfileField profileField, boolean overBrokeredUsers)Returns whether the given field is generally visible to the currently authenticated user.booleanisVisible(ProfileField profileField, String brokerIds)Returns whether the given field is visible to the currently authenticated user over a given user.PrincipalTypeprincipalTypeFor(ProfileField profileField)Returns the principal type associated with the given profile field, or null if none matchesvoidpurgeDisabled(BasicUser user)Purges any existing profile field values that are no longer enabled for this userProfileFieldtoBasicVO(ProfileField profileField)Converts a profile field to eitherBasicProfileFieldorCustomFieldVO.List<ProfileField>toBasicVOs(Collection<ProfileField> profileFields)Converts a list of profile fields to eitherBasicProfileFieldorCustomFieldVO.List<ProfileField>toEntities(Collection<ProfileField> profileFields)Converts a list of profile fields to entities.ProfileFieldtoEntity(ProfileField field)Returns a profile field compatible to storing as an entity, convertingUserCustomFieldVOs toUserCustomFields.SortedMap<Object,Object>toSearchFiltersMap(List<ProfileField> fieldsInSearch, Collection<? extends BaseValueForSearchDTO> fieldValues, boolean sanitize)Returns a map keyed by profile fields / address fields, whose values are the values for search of each fieldProfileFieldtoVO(ProfileField field)Returns a profile field compatible to send to client, convertingUserCustomFields toCustomFieldDetailedVOs.List<ProfileField>toVOs(Collection<ProfileField> profileFields)Converts a list of profile fields to eitherBasicProfileFieldorCustomFieldDetailedVO.
-
-
-
Field Detail
-
ATTR_SEARCH_CONTEXT
static final String ATTR_SEARCH_CONTEXT
Attribute name for scripting: The search context in which user profile fields are being used- See Also:
- Constant Field Values
-
ATTR_OVER_BROKERED_USERS
static final String ATTR_OVER_BROKERED_USERS
Attribute name for scripting: Whether the search is being done over brokered users or general search (only for brokers)- See Also:
- Constant Field Values
-
-
Method Detail
-
canEditProfile
boolean canEditProfile(BasicUser basicUser)
Returns whether the logged user can edit the profile of the given user (i.e can edit / manage privacy of at least one if its profile fields).
-
canViewHidden
boolean canViewHidden(BasicUser user)
Returns whether the logged user can view hidden fields of the given user
-
enablePrivacy
boolean enablePrivacy(BasicUser user)
Returns whether the given user can have private profile fields. Global admins and operators can never have private fields.
-
fill
void fill(DataWithBasicProfileFields data)
Fills properties in search data with basic profile fields
-
filterEnabledForUser
void filterEnabledForUser(BasicUser user, BooleanPropertiesHolder<ProfileField> holder)
Removes from the given BooleanPropertiesHolder all profile fields which are not enabled for the given user
-
getAddressQueryFields
List<AddressQueryField> getAddressQueryFields()
Returns the enabled address fields according to the current configuration
-
getAllProfileFields
List<ProfileField> getAllProfileFields()
-
getAllProfileFieldsForOperators
List<ProfileField> getAllProfileFieldsForOperators()
Returns all profile fields that apply for operators
-
getCustomFields
List<UserCustomField> getCustomFields(Collection<? extends ProfileField> profileFields)
Returns a list containing only the custom fields from the list of profile fields
-
getEnabledProfileFields
List<ProfileField> getEnabledProfileFields(BasicUser user)
Returns the list of profile fields that are enabled in the given user
-
getFieldActions
List<UserProfileFieldActions> getFieldActions(BasicUser user)
Returns the enabled fields for the given user (and visible to the logged user) and the actions that the logged user can perform over them The contexts which can be used are: - Internal or public registration: the given user should be transient - The logged user is viewing other user's profile. - The logged user is viewing his own profile, in which case the parameter should be the logged user.
-
getFieldActions
Set<ProfileFieldAction> getFieldActions(BasicUser user, ProfileField profileField)
Returns the possible actions over the given user's profile field- See Also:
getFieldActions(BasicUser)
-
getFieldActionsMap
Map<ProfileField,Set<ProfileFieldAction>> getFieldActionsMap(BasicUser user)
Returns, per profile field, the actions over fields of the given user by the logged user- See Also:
getFieldActions(BasicUser)
-
getFieldsByAction
List<ProfileField> getFieldsByAction(BasicUser user, ProfileFieldAction action)
Returns the profile fields which are enabled for the given action by the logged user over the given user
-
getFieldsContext
FieldsContext getFieldsContext(BasicUser user)
Returns the context (or functionality) where the fields are being displayed
-
getFieldsInMapResult
List<ProfileField> getFieldsInMapResult(boolean overBrokeredUser)
Returns the profile fields that are listed in the map results
-
getFieldsInUserList
List<ProfileField> getFieldsInUserList(boolean overBrokeredUser)
Returns the profile fields that are listed in the user list
-
getFieldValue
Object getFieldValue(BasicUser user, ProfileField profileField) throws FrameworkException
Returns the value of the given profle field for the given user. The value depends on the profile field type:BasicProfileField.LOGIN_NAME,BasicProfileField.FULL_NAME,BasicProfileField.EMAIL: Returns a string with the valueBasicProfileField.PHONE,BasicProfileField.ADDRESS,BasicProfileField.IMAGE: Returns a collection with the entitiesBasicProfileField.ACCOUNT_NUMBER: Returns a collection with the masked number for all active accounts- Custom field: Returns the custom field value. See
CustomFieldHelper.getValue(Long, Collection)
- Throws:
FrameworkException
-
getMatchingFields
List<ProfileField> getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, com.querydsl.core.types.dsl.BooleanPath path)
LikegetMatchingFields(BooleanPropertiesHolder, Map), but using a single property which must be true
-
getMatchingFields
List<ProfileField> getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, com.querydsl.core.types.dsl.BooleanPath path, Boolean filter)
LikegetMatchingFields(BooleanPropertiesHolder, Map), but using a single property
-
getMatchingFields
List<ProfileField> getMatchingFields(BooleanPropertiesHolder<ProfileField> holder, Map<com.querydsl.core.types.dsl.BooleanPath,Boolean> filter)
Returns a list of the enabled profile fields that matches all the given filters in the map: for each map key, retains only fields whose that boolean flag is the same as the map value.
-
getPrincipal
UserPrincipal getPrincipal(BasicUser basicUser, ChannelAccessAccessor channelAccess)
Returns a principal the given user can use to access a channel with the given configuration
-
getPrincipal
UserPrincipal getPrincipal(BasicUser basicUser, PrincipalType principalType)
Returns the principal of the given principal type for the given user, making sure it applies to the user. If the principal type is not applicable, or the given user has no value for it, returns null.
-
getProfileFieldFor
ProfileField getProfileFieldFor(PrincipalType principalType)
Returns the profile field corresponding to the given principal type, or null if not applicable
-
getProfileFieldsForExport
List<ProfileField> getProfileFieldsForExport()
Returns the visible profile fields that are enabled for export
-
getProfileFieldsInOperatorsList
List<ProfileField> getProfileFieldsInOperatorsList(User user)
Returns the profile fields which are marked to be returned on the operator list. If the given owner user is not null, uses his member product to determine it. If null, depends on the logged user: if a logged user with permission for operators, use the logged user products. If not, assumes no profile fields are shown in list.
-
getUserVariablesFunction
Function<String,String> getUserVariablesFunction(BasicUser user)
Returns a function which maps variables to formatted values (i.e Strings) for the given user. The variables can be:- An alias of any
BasicProfileField - Internal name of any user custom field
- address.<field>: A specific field of the default address (see
AddressFields) - Any of the values of
UserVariable
- An alias of any
-
getSearchFilters
List<ProfileField> getSearchFilters(ProfileFieldSearchContext context, boolean searchOverBrokeredUsers, Map<String,Object> loadValuesScriptVariables)
Returns the profile fields that can be used as filters in a search, according to the given context. The custom fields. The result can either be of entities or vos, according to the loadValuesScriptVariables parameter.- Returns:
- The actual result can be either composed of
BasicProfileField+UserCustomFieldif loadValuesScriptVariables is null, orBasicProfileField+CustomFieldDetailedVOwith the possible values loaded from scripts using the given script variables if loadValuesScriptVariables is not null.
-
getSendMediums
Set<SendMedium> getSendMediums(BasicUser user)
Returns the send mediums with corresponding profile fields enabled (and valid) for the given user
-
getSimpleAndAdvancedSearchFilters
Pair<List<ProfileField>,List<ProfileField>> getSimpleAndAdvancedSearchFilters(ProfileFieldSearchContext context, boolean searchOverBrokeredUsers, Map<String,Object> loadValuesScriptVariables)
Same asgetSearchFilters(ProfileFieldSearchContext, boolean, Map)but returns the filters separated by simple and advanced, which is defined in the products. The first list are the simple and the second are the advanced.
-
getSingleFieldValue
Object getSingleFieldValue(BasicUser user, ProfileField field)
Similar togetFieldValue(BasicUser, ProfileField), except that never returns collections.
-
getUserProfileFields
List<ProductUserProfileFieldDTO> getUserProfileFields(ProductAccessor products)
Returns the aggregate user profile fields for the given products accessor. Should not be called when there is an user, only for general products.
-
getUserVariables
List<ParameterVO> getUserVariables()
Returns the list of available user variables. For account related variables (e.g balance, number, etc) return the generic 'account' prefix for all of them
-
getVisibleProfileFields
List<ProfileField> getVisibleProfileFields(BasicUser user)
Returns all profile fields which are both visible for the current user and enabled for the given user
-
isAllowed
boolean isAllowed(BasicUser user, ProfileField profileField, ProfileFieldAction action)
Returns whether the given action is allowed for the given field / user
-
isAllowedForOperator
boolean isAllowedForOperator(ProfileField profileField)
Returns whether the given profile field can be used for operators
-
isDefaultHidden
boolean isDefaultHidden(Group group, ProfileField profileField) throws FrameworkException
Returns whether the given field is marked as hidden for the given group configuration.- Throws:
FrameworkException
-
isEnabled
boolean isEnabled(BasicUser user, ProfileField profileField)
Returns whether the given profile field is enabled for the given products accessor
-
isHidden
boolean isHidden(BasicUser user, ProfileField profileField, Object value) throws FrameworkException
Returns whether the given field is marked as hidden for the given user. Does not take into account the logged user permissions, is the raw hidden state. For phone or address, the phone or address value must be passed in the value field, otherwise (if null) returns false.- Throws:
IllegalArgumentException- if an inconsistent value is passed in. For example, if the profile field is phone, the value must either be null or a phone belonging to the same userFrameworkException
-
isVisible
boolean isVisible(ProfileField profileField, boolean overBrokeredUsers)
Returns whether the given field is generally visible to the currently authenticated user.- Parameters:
overBrokeredUsers- Indicates whether the general visibility is over brokered users for brokers
-
isVisible
boolean isVisible(ProfileField profileField, String brokerIds)
Returns whether the given field is visible to the currently authenticated user over a given user.- Parameters:
brokerIds- Comma-separated list of broker ids. The list is used to determine whether the authenticated user is viewing the field as broker or not (i.e as an admin/member). In case the authenticated user's id is contained in the list then it's treated as broker, thus, summing broker and member products. If not, will use only member products.
-
principalTypeFor
PrincipalType principalTypeFor(ProfileField profileField)
Returns the principal type associated with the given profile field, or null if none matches
-
purgeDisabled
void purgeDisabled(BasicUser user)
Purges any existing profile field values that are no longer enabled for this user
-
toBasicVO
ProfileField toBasicVO(ProfileField profileField)
Converts a profile field to eitherBasicProfileFieldorCustomFieldVO.- See Also:
toBasicVO(ProfileField)
-
toBasicVOs
List<ProfileField> toBasicVOs(Collection<ProfileField> profileFields)
Converts a list of profile fields to eitherBasicProfileFieldorCustomFieldVO.- See Also:
toBasicVO(ProfileField)
-
toEntities
List<ProfileField> toEntities(Collection<ProfileField> profileFields)
Converts a list of profile fields to entities.- See Also:
toEntity(ProfileField)
-
toEntity
ProfileField toEntity(ProfileField field)
Returns a profile field compatible to storing as an entity, convertingUserCustomFieldVOs toUserCustomFields.
-
toSearchFiltersMap
SortedMap<Object,Object> toSearchFiltersMap(List<ProfileField> fieldsInSearch, Collection<? extends BaseValueForSearchDTO> fieldValues, boolean sanitize)
Returns a map keyed by profile fields / address fields, whose values are the values for search of each field
-
toVO
ProfileField toVO(ProfileField field)
Returns a profile field compatible to send to client, convertingUserCustomFields toCustomFieldDetailedVOs.
-
toVOs
List<ProfileField> toVOs(Collection<ProfileField> profileFields)
Converts a list of profile fields to eitherBasicProfileFieldorCustomFieldDetailedVO.- See Also:
toVO(ProfileField)
-
-