Package org.cyclos.impl.utils
Class AbstractUserVisibilityApplier
- java.lang.Object
-
- org.cyclos.impl.utils.AbstractUserVisibilityApplier
-
- Direct Known Subclasses:
ElasticUserVisibilityApplier,JPAUserVisibilityApplier,SQLUserVisibilityApplier
public abstract class AbstractUserVisibilityApplier extends Object
Base class for the user visibility appliers.
The idea behind such appliers is to add a bottom-line of filters to ensure only data the logged user can view is returned as a result in a search.
IMPORTANT: Please make sure all sub-classes are in sync according to the business rules
The concrete sub-classes are:JPAUserVisibilityApplier,SQLUserVisibilityApplier,ElasticUserVisibilityApplier
Obtained from:DBQuery.visibility(org.cyclos.entities.users.QUser),NativeQuery.visibility(com.querydsl.core.types.dsl.NumberPath, com.querydsl.core.types.dsl.NumberPath)andElasticsearchEntitySearchHandlerImpl.visibility(org.cyclos.impl.search.elasticsearch.QueryAccessor)
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionDatasessionData
-
Constructor Summary
Constructors Constructor Description AbstractUserVisibilityApplier()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidapply(boolean onlySelf, GroupList groupList, boolean includeGlobals)Apply the visibility rules for data of other users or self.protected abstract voidapplyBrokerOrSelf(User loggedUser)protected abstract voidapplyGroups(Set<Group> groups)protected abstract voidapplyGroupsOrBrokerOrSelf(Set<Group> groups, User loggedUser)protected abstract voidapplyGroupsOrSelf(Set<Group> groups, User loggedUser)protected abstract voidapplySelf(User loggedUser)protected abstract voidbogusCondition()Adds a bogus condition to return nothingvoidonlySelf()Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, for only its own data (e.g used when searching user records).voidonlySelf(GroupList groupList)Apply the rules according to the given list of groups and, in case of member, for only its own data.voidothers()Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, allowing view data of other users (used when searching ads).voidothers(boolean includeGlobals)Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, allowing view data of other users (used when searching ads).voidothers(GroupList groupList)Apply the rules according to the given list of groups and, in case of member, allowing view data of other users.voidothers(GroupList groupList, boolean includeGlobals)Apply the rules according to the given list of groups and, in case of member, allowing view data of other users.
-
-
-
Field Detail
-
sessionData
protected SessionData sessionData
-
-
Method Detail
-
apply
public final void apply(boolean onlySelf, GroupList groupList, boolean includeGlobals)Apply the visibility rules for data of other users or self. It is preferable to use the available shortcut methods instead of this directly:onlySelf(),others()- Parameters:
onlySelf- Only for members: true means the logged member can view only its own data. E.g when searching for records the user can not view records of other users but for ads he can.groupList- the list of groups to restrict the results.
-
onlySelf
public final void onlySelf()
Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, for only its own data (e.g used when searching user records).
-
onlySelf
public final void onlySelf(GroupList groupList)
Apply the rules according to the given list of groups and, in case of member, for only its own data.
-
others
public final void others()
Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, allowing view data of other users (used when searching ads).
-
others
public final void others(boolean includeGlobals)
Apply the rules according to theGroupList.ACCESSIBLElist of groups and, in case of member, allowing view data of other users (used when searching ads).
-
others
public final void others(GroupList groupList)
Apply the rules according to the given list of groups and, in case of member, allowing view data of other users.
-
others
public final void others(GroupList groupList, boolean includeGlobals)
Apply the rules according to the given list of groups and, in case of member, allowing view data of other users.
-
applyBrokerOrSelf
protected abstract void applyBrokerOrSelf(User loggedUser)
-
applyGroupsOrBrokerOrSelf
protected abstract void applyGroupsOrBrokerOrSelf(Set<Group> groups, User loggedUser)
-
applySelf
protected abstract void applySelf(User loggedUser)
-
bogusCondition
protected abstract void bogusCondition()
Adds a bogus condition to return nothing
-
-