Package org.cyclos.impl.access
Class UserSessionData
- java.lang.Object
-
- org.cyclos.impl.access.AbstractSessionData
-
- org.cyclos.impl.access.UserSessionData
-
- All Implemented Interfaces:
RoleContainer,DelegatingUserPrincipal,SessionData,UserPrincipal
- Direct Known Subclasses:
AccessClientSessionData,DirectUserSessionData,OidcSessionData,StatefulUserSessionData,StatelessUserSessionData
public abstract class UserSessionData extends AbstractSessionData
Session data for a logged user
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cyclos.impl.access.AbstractSessionData
AbstractSessionData.SessionDataChannelAccessAccessor
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.access.AbstractSessionData
requestData
-
-
Constructor Summary
Constructors Constructor Description UserSessionData(RequestData requestData)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckConsistency()Checks for consistency.protected LongdoGetConfigurationId()protected abstract LongdoGetLoggedBasicUserId()protected List<String>doGetPreferredLocales()protected ProductsAccessordoGetProducts()Must be implemented to return a a validProductsAccessorprotected SessionDataSubjectIddoGetSubjectId()protected abstract UserPrincipaldoGetUserPrincipal()protected booleandoHasExpiredPassword()protected booleandoHasPendingAgreements(ProductsAccessor accessor)protected booleandoHasPendingSecondaryPassword()protected booleandoHasPermission(Permission permission)protected booleanfallbackToDefaultLocales()AccessClientgetAccessClient()Set<BasicGroup>getAccessibleBasicGroups()Returns the basic groups accessible by the current sessionUserAccountTypegetAccountType()UserAuthVOgetAuthenticatedUser()Returns the user authentication data, or null if noneBasicUsergetBasicUser()ChannelAccessAccessorgetChannelAccessAccessor()Returns the accessor for the access channel (i.e the original channel used to access Cyclos) access settings.UserCustomFieldValuegetCustomFieldValue()GroupgetGroup()Returns the group of the authenticated user, if anyBasicUsergetLoggedBasicUser()Returns the authenticated basic user, or null if noneMobilePhonegetMobilePhone()protected Set<Permission>getPermissions()StringgetPrincipal()Should return a value that can be used to identify the user.PrincipalTypegetPrincipalType()protected Set<Role>getRoles()TokengetToken()TrustedDevicegetTrustedDevice()UserPrincipalgetUserPrincipal()booleanhasExpiredPassword()Returns whether the user's access password has expiredbooleanhasExpiredSecondaryPassword()booleanhasPendingAgreements()Returns whether the logged user has some pending agreementsbooleanhasPengingSecondaryPassword()Returns whether the user has validated its secondary password (if any).booleanhasRequiredValue(Permission permission, Object value)Returns whether the current user has access to the given required value for the given permissionbooleanisAdmin()Returns whether theRole.ADMINis grantedbooleanisAdminOf(BasicUser basicUser)Returns whether the current user is an administrator of the given userbooleanisAliasOperator()Returns whether theRole.ALIAS_OPERATORis grantedbooleanisBroker()Returns whether theRole.BROKERis grantedbooleanisBrokerOf(BasicUser basicUser)Returns whether the current user is a broker of the given userbooleanisGlobalAdmin()Returns whether theRole.GLOBAL_ADMINis granted Returns true if the user is the "root" user.booleanisLoggedIn()Returns whether the current session represents a userbooleanisMember()Returns whether theRole.MEMBERis grantedbooleanisMemberOnly()Returns true if the logged user has onlyRolemember.booleanisNetworkAdmin()Returns whether theRole.NETWORK_ADMINis grantedbooleanisOperator()Returns whether theRole.OPERATORis grantedbooleanisOwnerOf(BasicUser operator)Returns whether current user is either the owner member of a given operator or as another alias operatorbooleanisRestrictedOperator()Returns whether theRole.RESTRICTED_OPERATORis grantedbooleanisVisible(EntityCheck<SimpleEntity> entityCheck, SimpleEntity entity)Returns whether the given entity is visible under the given entity checkbooleanmanages(BasicUser basicUser)Returns whether the current user manages the given user.booleanrelatesTo(BasicUser basicUser)Returns whether the current user is related to (is allowed to view) the given userprotected ProductsAccessorresolveProductsAccessor(ProductsHandler productsHandler)protected booleanreturnPendingPasswords()-
Methods inherited from class org.cyclos.impl.access.AbstractSessionData
bean, doGetConfigurationAccessor, getAccessChannel, getAccessToken, getApplicationContext, getChannel, getChannelConfiguration, getChannelSettingsAccessor, getConfiguration, getConfigurationEntity, getFailedActionHandler, getIdentityProvider, getLoggedOperator, getLoggedUser, getNetwork, getPin, getProducts, getRawEntityManagerHandler, getRemoteAddress, getRequestData, getSession, getSubjectId, hasPermission, isGlobalAdminInNetwork, isGuest, isManagerOf, isMultiNetworkAdminInGlobalMode, isScript, isSelf, isSystem, isTrusted, isUserManager, resolveNetworkId, runAsSystem, runAsSystem, shouldCheckRemoteAddress
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.access.DelegatingUserPrincipal
getDelegate
-
Methods inherited from interface org.cyclos.impl.access.SessionData
getAccessChannelName, getChannelName, hasPermission, isRest
-
-
-
-
Constructor Detail
-
UserSessionData
public UserSessionData(RequestData requestData)
-
-
Method Detail
-
checkConsistency
public void checkConsistency() throws InvalidSessionDataException, LoginExceptionDescription copied from interface:SessionDataChecks for consistency. Called before invoking a service method, as system- Specified by:
checkConsistencyin interfaceSessionData- Overrides:
checkConsistencyin classAbstractSessionData- Throws:
InvalidSessionDataExceptionLoginException
-
getAccessClient
public final AccessClient getAccessClient()
- Specified by:
getAccessClientin interfaceUserPrincipal- Overrides:
getAccessClientin classAbstractSessionData
-
getAccessibleBasicGroups
public Set<BasicGroup> getAccessibleBasicGroups()
Description copied from interface:SessionDataReturns the basic groups accessible by the current session
-
getAccountType
public final UserAccountType getAccountType()
- Specified by:
getAccountTypein interfaceUserPrincipal- Overrides:
getAccountTypein classAbstractSessionData
-
getAuthenticatedUser
public UserAuthVO getAuthenticatedUser()
Description copied from interface:SessionDataReturns the user authentication data, or null if none
-
getBasicUser
public final BasicUser getBasicUser()
- Specified by:
getBasicUserin interfaceUserPrincipal- Overrides:
getBasicUserin classAbstractSessionData
-
getChannelAccessAccessor
public ChannelAccessAccessor getChannelAccessAccessor()
Description copied from interface:SessionDataReturns the accessor for the access channel (i.e the original channel used to access Cyclos) access settings. Always uses the user's own settings. For example, if a global administrator is switched to a network, will get his settings, from global mode.- Specified by:
getChannelAccessAccessorin interfaceSessionData- Overrides:
getChannelAccessAccessorin classAbstractSessionData
-
getCustomFieldValue
public final UserCustomFieldValue getCustomFieldValue()
- Specified by:
getCustomFieldValuein interfaceUserPrincipal- Overrides:
getCustomFieldValuein classAbstractSessionData
-
getGroup
public Group getGroup()
Description copied from interface:SessionDataReturns the group of the authenticated user, if any
-
getLoggedBasicUser
public final BasicUser getLoggedBasicUser()
Description copied from interface:SessionDataReturns the authenticated basic user, or null if none
-
getMobilePhone
public final MobilePhone getMobilePhone()
- Specified by:
getMobilePhonein interfaceUserPrincipal- Overrides:
getMobilePhonein classAbstractSessionData
-
getPrincipal
public final String getPrincipal()
Description copied from interface:UserPrincipalShould return a value that can be used to identify the user. In case the value should be hidden, implementors should return null.- Specified by:
getPrincipalin interfaceDelegatingUserPrincipal- Specified by:
getPrincipalin interfaceUserPrincipal- Overrides:
getPrincipalin classAbstractSessionData
-
getPrincipalType
public final PrincipalType getPrincipalType()
- Specified by:
getPrincipalTypein interfaceUserPrincipal- Overrides:
getPrincipalTypein classAbstractSessionData
-
getToken
public final Token getToken()
- Specified by:
getTokenin interfaceUserPrincipal- Overrides:
getTokenin classAbstractSessionData
-
getTrustedDevice
public final TrustedDevice getTrustedDevice()
- Specified by:
getTrustedDevicein interfaceUserPrincipal- Overrides:
getTrustedDevicein classAbstractSessionData
-
getUserPrincipal
public final UserPrincipal getUserPrincipal()
-
hasExpiredPassword
public final boolean hasExpiredPassword()
Returns whether the user's access password has expired
-
hasExpiredSecondaryPassword
public boolean hasExpiredSecondaryPassword()
-
hasPendingAgreements
public final boolean hasPendingAgreements()
Returns whether the logged user has some pending agreements
-
hasPengingSecondaryPassword
public final boolean hasPengingSecondaryPassword()
Returns whether the user has validated its secondary password (if any).- See Also:
hasPengingSecondaryPassword()
-
hasRequiredValue
public boolean hasRequiredValue(Permission permission, Object value)
Description copied from interface:SessionDataReturns whether the current user has access to the given required value for the given permission
-
isAdmin
public boolean isAdmin()
Description copied from interface:RoleContainerReturns whether theRole.ADMINis granted- Specified by:
isAdminin interfaceRoleContainer- Overrides:
isAdminin classAbstractSessionData
-
isAdminOf
public boolean isAdminOf(BasicUser basicUser)
Description copied from interface:SessionDataReturns whether the current user is an administrator of the given user- Specified by:
isAdminOfin interfaceSessionData- Overrides:
isAdminOfin classAbstractSessionData
-
isAliasOperator
public boolean isAliasOperator()
Description copied from interface:RoleContainerReturns whether theRole.ALIAS_OPERATORis granted- Specified by:
isAliasOperatorin interfaceRoleContainer- Overrides:
isAliasOperatorin classAbstractSessionData
-
isBroker
public boolean isBroker()
Description copied from interface:RoleContainerReturns whether theRole.BROKERis granted- Specified by:
isBrokerin interfaceRoleContainer- Overrides:
isBrokerin classAbstractSessionData
-
isBrokerOf
public boolean isBrokerOf(BasicUser basicUser)
Description copied from interface:SessionDataReturns whether the current user is a broker of the given user- Specified by:
isBrokerOfin interfaceSessionData- Overrides:
isBrokerOfin classAbstractSessionData
-
isGlobalAdmin
public boolean isGlobalAdmin()
Description copied from interface:RoleContainerReturns whether theRole.GLOBAL_ADMINis granted Returns true if the user is the "root" user. For multi-networks administrators it returns false- Specified by:
isGlobalAdminin interfaceRoleContainer- Overrides:
isGlobalAdminin classAbstractSessionData- See Also:
RoleContainer.isGlobalAdmin()
-
isLoggedIn
public boolean isLoggedIn()
Description copied from interface:SessionDataReturns whether the current session represents a user- Specified by:
isLoggedInin interfaceSessionData- Overrides:
isLoggedInin classAbstractSessionData
-
isMember
public boolean isMember()
Description copied from interface:RoleContainerReturns whether theRole.MEMBERis granted- Specified by:
isMemberin interfaceRoleContainer- Overrides:
isMemberin classAbstractSessionData
-
isMemberOnly
public boolean isMemberOnly()
Description copied from interface:SessionDataReturns true if the logged user has onlyRolemember.- Specified by:
isMemberOnlyin interfaceSessionData- Overrides:
isMemberOnlyin classAbstractSessionData
-
isNetworkAdmin
public boolean isNetworkAdmin()
Description copied from interface:RoleContainerReturns whether theRole.NETWORK_ADMINis granted- Specified by:
isNetworkAdminin interfaceRoleContainer- Overrides:
isNetworkAdminin classAbstractSessionData
-
isOperator
public boolean isOperator()
Description copied from interface:RoleContainerReturns whether theRole.OPERATORis granted- Specified by:
isOperatorin interfaceRoleContainer- Overrides:
isOperatorin classAbstractSessionData
-
isOwnerOf
public boolean isOwnerOf(BasicUser operator)
Description copied from interface:SessionDataReturns whether current user is either the owner member of a given operator or as another alias operator- Specified by:
isOwnerOfin interfaceSessionData- Overrides:
isOwnerOfin classAbstractSessionData
-
isRestrictedOperator
public boolean isRestrictedOperator()
Description copied from interface:RoleContainerReturns whether theRole.RESTRICTED_OPERATORis granted- Specified by:
isRestrictedOperatorin interfaceRoleContainer- Overrides:
isRestrictedOperatorin classAbstractSessionData
-
isVisible
public boolean isVisible(EntityCheck<SimpleEntity> entityCheck, SimpleEntity entity)
Description copied from interface:SessionDataReturns whether the given entity is visible under the given entity check
-
manages
public boolean manages(BasicUser basicUser)
Description copied from interface:SessionDataReturns whether the current user manages the given user. If the logged user and the given one are the same user then it returns true.
-
relatesTo
public boolean relatesTo(BasicUser basicUser)
Description copied from interface:SessionDataReturns whether the current user is related to (is allowed to view) the given user
-
doGetConfigurationId
protected final Long doGetConfigurationId()
- Specified by:
doGetConfigurationIdin classAbstractSessionData
-
doGetLoggedBasicUserId
protected abstract Long doGetLoggedBasicUserId()
-
doGetPreferredLocales
protected List<String> doGetPreferredLocales()
- Overrides:
doGetPreferredLocalesin classAbstractSessionData
-
doGetProducts
protected final ProductsAccessor doGetProducts()
Description copied from class:AbstractSessionDataMust be implemented to return a a validProductsAccessor- Specified by:
doGetProductsin classAbstractSessionData
-
doGetSubjectId
protected SessionDataSubjectId doGetSubjectId()
- Specified by:
doGetSubjectIdin classAbstractSessionData
-
doGetUserPrincipal
protected abstract UserPrincipal doGetUserPrincipal()
-
doHasExpiredPassword
protected boolean doHasExpiredPassword()
-
doHasPendingAgreements
protected boolean doHasPendingAgreements(ProductsAccessor accessor)
-
doHasPendingSecondaryPassword
protected boolean doHasPendingSecondaryPassword()
-
doHasPermission
protected boolean doHasPermission(Permission permission)
- Specified by:
doHasPermissionin classAbstractSessionData
-
fallbackToDefaultLocales
protected boolean fallbackToDefaultLocales()
-
getPermissions
protected Set<Permission> getPermissions()
-
resolveProductsAccessor
protected ProductsAccessor resolveProductsAccessor(ProductsHandler productsHandler)
-
returnPendingPasswords
protected boolean returnPendingPasswords()
-
-