Package org.cyclos.impl.access
Class ScriptSessionData
- java.lang.Object
-
- org.cyclos.impl.access.AbstractSessionData
-
- org.cyclos.impl.access.ScriptSessionData
-
- All Implemented Interfaces:
ProcessableForProxying,DelegatingUserPrincipal,RoleContainer,UserPrincipal,SessionData
public class ScriptSessionData extends AbstractSessionData
Session data used to run scripts.
It wraps anotherSessionDatapreserving the logged user. If it must run as system then it has all permissions and it's related to all users (like system does). Otherwise it behaves as the wrapped session.
-
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckConsistency()Checks for consistency.protected LongdoGetConfigurationId()protected List<String>doGetPreferredLocales()protected ProductsAccessordoGetProducts()Must be implemented to return a a validProductsAccessorprotected SessionDataSubjectIddoGetSubjectId()protected booleandoHasPermission(Permission permission)StringgetAccessChannelName()Returns the internal name of the original channel (i.e the channel used to access Cyclos) .AccessClientgetAccessClient()Set<BasicGroup>getAccessibleBasicGroups()Returns the basic groups accessible by the current sessionOidcAccessTokengetAccessToken()Returns the OpenID Connect / OAuth2 access token for this sessionUserAuthVOgetAuthenticatedUser()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.StringgetChannelName()Returns the internal name of the current channel.ChannelSettingsAccessorgetChannelSettingsAccessor()Returns the accessor for the current channel (i.e the channel used to run the service method) general settings.SessionDatagetDelegate()Returns a delegate user principal.GroupgetGroup()Returns the group of the authenticated user, if anyBasicUsergetLoggedBasicUser()Returns the authenticated basic user, or null if nonePingetPin()Returns thePinused for this session only if the user was authenticated using such mechanism.StringgetPrincipal()Should return a value that can be used to identify the user.PrincipalTypegetPrincipalType()StringgetRemoteAddress()Returns the remote address, of the client accessing the applicationSessiongetSession()Returns the session in case this session data performed a loginSessionDataSubjectIdgetSubjectId()Returns the subject idTokengetToken()TrustedDevicegetTrustedDevice()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 user)Returns whether the current user is an administrator of the given userbooleanisAliasOperator()Returns whether theRole.ALIAS_OPERATORis grantedbooleanisBroker()Returns whether theRole.BROKERis grantedbooleanisBrokerOf(BasicUser user)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.booleanisGlobalAdminInNetwork()Returns whether a global admin OR a global restricted has switched to a network.booleanisGuest()Returns whether the current session represents a guestbooleanisLoggedIn()Returns whether the current session represents a userbooleanisManagerOf(BasicUser user)Returns whether the current user is a manager of the given user and is not the given user.booleanisMember()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 grantedbooleanisScript()Returns whether this session is running under a scriptbooleanisSystem()Returns whether the current session represents a system taskbooleanisUserManager()Returns whether theRole.ADMINorRole.BROKERroles are grantedbooleanisVisible(EntityCheck<SimpleEntity> entityCheck, SimpleEntity entity)Returns whether the given entity is visible under the given entity checkbooleanmanages(BasicUser user)Returns whether the current user manages the given user.booleanrelatesTo(BasicUser user)Returns whether the current user is related to (is allowed to view) the given userSessionDataunwrap()Returns the underlyingSessionDataif the current one is a wrapper-
Methods inherited from class org.cyclos.impl.access.AbstractSessionData
bean, doGetConfigurationAccessor, getAccessChannel, getAccountType, getApplicationContext, getChannel, getChannelConfiguration, getConfiguration, getConfigurationEntity, getCustomFieldValue, getIdentityProvider, getIpAddressService, getLoggedOperator, getLoggedUser, getMobilePhone, getNetwork, getProducts, getRawEntityManagerHandler, getRequestData, hasPermission, isMultiNetworkAdminInGlobalMode, isSelf, isTrusted, 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.SessionData
getProxyClass, hasPermission, ifWraps, isRest
-
-
-
-
Method Detail
-
checkConsistency
public void checkConsistency() throws InvalidSessionDataExceptionDescription copied from interface:SessionDataChecks for consistency. Called before invoking a service method, as system- Specified by:
checkConsistencyin interfaceSessionData- Overrides:
checkConsistencyin classAbstractSessionData- Throws:
InvalidSessionDataException
-
getAccessChannelName
public String getAccessChannelName()
Description copied from interface:SessionDataReturns the internal name of the original channel (i.e the channel used to access Cyclos) . Must be accessible outside transactions.
-
getAccessClient
public 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
-
getAccessToken
public OidcAccessToken getAccessToken()
Description copied from interface:SessionDataReturns the OpenID Connect / OAuth2 access token for this session- Specified by:
getAccessTokenin interfaceSessionData- Overrides:
getAccessTokenin classAbstractSessionData
-
getAuthenticatedUser
public UserAuthVO getAuthenticatedUser()
Description copied from interface:SessionDataReturns the user authentication data, or null if none
-
getBasicUser
public 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
-
getChannelName
public String getChannelName()
Description copied from interface:SessionDataReturns the internal name of the current channel. Must be accessible outside transactions.
-
getChannelSettingsAccessor
public ChannelSettingsAccessor getChannelSettingsAccessor()
Description copied from interface:SessionDataReturns the accessor for the current channel (i.e the channel used to run the service method) general settings. Always uses the current configuration settings. For example, if a global administrator is switched to a network, will get the settings for the network administrators.- Specified by:
getChannelSettingsAccessorin interfaceSessionData- Overrides:
getChannelSettingsAccessorin classAbstractSessionData
-
getDelegate
public SessionData getDelegate()
Description copied from interface:DelegatingUserPrincipalReturns a delegate user principal. Implementations that are "pure" principals (there's a principal type representing it) will return themselves. Other implementations, such as session, PIN, etc, will return a delegate according to the principal type.
-
getGroup
public Group getGroup()
Description copied from interface:SessionDataReturns the group of the authenticated user, if any
-
getLoggedBasicUser
public BasicUser getLoggedBasicUser()
Description copied from interface:SessionDataReturns the authenticated basic user, or null if none
-
getPin
public Pin getPin()
Description copied from interface:SessionDataReturns thePinused for this session only if the user was authenticated using such mechanism.- Specified by:
getPinin interfaceSessionData- Overrides:
getPinin classAbstractSessionData
-
getPrincipal
public 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 PrincipalType getPrincipalType()
- Specified by:
getPrincipalTypein interfaceUserPrincipal- Overrides:
getPrincipalTypein classAbstractSessionData
-
getRemoteAddress
public String getRemoteAddress()
Description copied from interface:SessionDataReturns the remote address, of the client accessing the application- Specified by:
getRemoteAddressin interfaceSessionData- Overrides:
getRemoteAddressin classAbstractSessionData
-
getSession
public Session getSession()
Description copied from interface:SessionDataReturns the session in case this session data performed a login- Specified by:
getSessionin interfaceSessionData- Overrides:
getSessionin classAbstractSessionData
-
getSubjectId
public SessionDataSubjectId getSubjectId()
Description copied from interface:SessionDataReturns the subject id- Specified by:
getSubjectIdin interfaceSessionData- Overrides:
getSubjectIdin classAbstractSessionData
-
getToken
public Token getToken()
- Specified by:
getTokenin interfaceUserPrincipal- Overrides:
getTokenin classAbstractSessionData
-
getTrustedDevice
public TrustedDevice getTrustedDevice()
- Specified by:
getTrustedDevicein interfaceUserPrincipal- Overrides:
getTrustedDevicein classAbstractSessionData
-
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 user)
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 user)
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()
-
isGlobalAdminInNetwork
public boolean isGlobalAdminInNetwork()
Description copied from class:AbstractSessionDataReturns whether a global admin OR a global restricted has switched to a network.- Specified by:
isGlobalAdminInNetworkin interfaceSessionData- Overrides:
isGlobalAdminInNetworkin classAbstractSessionData
-
isGuest
public boolean isGuest()
Description copied from interface:SessionDataReturns whether the current session represents a guest- Specified by:
isGuestin interfaceSessionData- Overrides:
isGuestin classAbstractSessionData
-
isLoggedIn
public boolean isLoggedIn()
Description copied from interface:SessionDataReturns whether the current session represents a user- Specified by:
isLoggedInin interfaceSessionData- Overrides:
isLoggedInin classAbstractSessionData
-
isManagerOf
public boolean isManagerOf(BasicUser user)
Description copied from interface:SessionDataReturns whether the current user is a manager of the given user and is not the given user.- Specified by:
isManagerOfin interfaceSessionData- Overrides:
isManagerOfin 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:RoleContainerReturns true if the logged user has onlyRolemember.- Specified by:
isMemberOnlyin interfaceRoleContainer- 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
-
isScript
public boolean isScript()
Description copied from interface:SessionDataReturns whether this session is running under a script- Specified by:
isScriptin interfaceSessionData- Overrides:
isScriptin classAbstractSessionData
-
isSystem
public boolean isSystem()
Description copied from interface:SessionDataReturns whether the current session represents a system task- Specified by:
isSystemin interfaceSessionData- Overrides:
isSystemin classAbstractSessionData
-
isUserManager
public boolean isUserManager()
Description copied from interface:RoleContainerReturns whether theRole.ADMINorRole.BROKERroles are granted- Specified by:
isUserManagerin interfaceRoleContainer- Overrides:
isUserManagerin 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 user)
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 user)
Description copied from interface:SessionDataReturns whether the current user is related to (is allowed to view) the given user
-
unwrap
public SessionData unwrap()
Description copied from interface:SessionDataReturns the underlyingSessionDataif the current one is a wrapper- Specified by:
unwrapin interfaceSessionData- Overrides:
unwrapin classAbstractSessionData
-
doGetConfigurationId
protected Long doGetConfigurationId()
- Specified by:
doGetConfigurationIdin classAbstractSessionData
-
doGetPreferredLocales
protected List<String> doGetPreferredLocales()
- Overrides:
doGetPreferredLocalesin classAbstractSessionData
-
doGetProducts
protected 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
-
doHasPermission
protected boolean doHasPermission(Permission permission)
- Specified by:
doHasPermissionin classAbstractSessionData
-
-