Package net.sf.basedb.core
Class PluginSessionControl
java.lang.Object
net.sf.basedb.core.SessionControl
net.sf.basedb.core.PluginSessionControl
- All Implemented Interfaces:
AutoCloseable
This is a special session control implementation that is used for
executing plugins that prevents them from logging in or out. If
the plugin has enabled permissions those permissions are also loaded and
taken into account when checking access to items.
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2019-03-21 12:52:11 +0100 (tors, 21 mars 2019) $
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.basedb.core.SessionControl
SessionControl.MainContext, SessionControl.UnverifiedDeviceInfo
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPluginSessionControl
(String id, SessionControl parent, PluginDefinition plugin, Job job) Create a new plugin session control -
Method Summary
Modifier and TypeMethodDescriptiongetPluginSessionControl
(PluginDefinition plugin, Job job) Create a new session control for executing a plugin using the same parent as this session control has.impersonateLogin
(int userId, String comment) Log in as another user or create a clone of the currently logged in user's session.void
login
(LoginRequest loginRequest) Log in to BASE.(package private) void
void
logout()
Do nothing, a plugin is not allowed to log out.Methods inherited from class net.sf.basedb.core.SessionControl
clearDbControlCache, close, deleteContext, deleteCurrentContexts, getActiveProjectId, getActiveProjectName, getActiveProjectPermissions, getActiveRoles, getAllCurrentContexts, getAllPermissions, getAllPermissions, getAllRoles, getAuthenticationMethod, getClientDefaultSetting, getClientId, getClientName, getContext, getContextNames, getContextNames, getCurrentClientId, getCurrentClientName, getCurrentContext, getCurrentContext, getCurrentContext, getCurrentContext, getCurrentExternalClientId, getCurrentSessionId, getCurrentSubcontext, getDefaultTransactionName, getDeviceId, getDeviceName, getExternalClientId, getFriends, getGroups, getId, getInactiveRoles, getItemKeyId, getItemKeys, getItemKeys, getJobId, getJobName, getJobSessionControl, getLastAccess, getLocale, getLocation, getLoggedInUserId, getLoggedInUserLogin, getLoggedInUserName, getNamedContexts, getPluginId, getPluginName, getPluginPermissions, getProjectKeyId, getProjectKeys, getProjectKeys, getProjectPermission, getProjects, getRemoteId, getRolePermissions, getRoles, getSessionSetting, getSharedPermissions, getUnverifiedDeviceInfo, getUserClientSetting, getUserDefaultSetting, hasPermission, hasSystemPermission, impersonateLogin, isAllowedToUseClient, isClosed, isDenied, isFriendOf, isImpersonated, isLoggedIn, isMemberOf, isMemberOf, isMemberOf, isRoleInactive, loadContext, loadContext, newDbControl, newDbControl, reloadPermissions, reloadSettings, saveCurrentContextAs, saveCurrentContextAs, setActiveProject, setCurrentClient, setCurrentSubcontext, setRoleInactive, setSessionSetting, setUserClientSetting, setUserDefaultSetting, updateLastAccess, verifyDevice, verifyUserInternal
-
Field Details
-
parent
-
-
Constructor Details
-
PluginSessionControl
PluginSessionControl(String id, SessionControl parent, PluginDefinition plugin, Job job) Create a new plugin session control- Parameters:
id
- The ID of the session controlparent
- The parent session control which settings and permissions should be copied fromplugin
- The plugin that is executing
-
-
Method Details
-
login
- Overrides:
login
in classSessionControl
- Throws:
PermissionDeniedException
- Always
-
login
Description copied from class:SessionControl
Log in to BASE. The method checks that the given login is valid, the password is correct and that the user has USE permission for the client application if one has been specified.- Overrides:
login
in classSessionControl
- Parameters:
loginRequest
- Request containing login/password and other information- See Also:
-
logout
Do nothing, a plugin is not allowed to log out.- Overrides:
logout
in classSessionControl
- Throws:
BaseException
- If there is an error- See Also:
-
impersonateLogin
public SessionControl impersonateLogin(int userId, String comment) throws ItemNotFoundException, PermissionDeniedException, BaseException Description copied from class:SessionControl
Log in as another user or create a clone of the currently logged in user's session. If this call is successful, you will get a newSessionControl
object which is equivalent to aSessionControl
where that user logged in by normal means. This method requires that the logged in user hasPermission.ACT_AS_ANOTHER_USER
permission or that the userId is the same as the currently logged in user.- Overrides:
impersonateLogin
in classSessionControl
- Parameters:
userId
- The id of the user to login ascomment
- A comment that will be placed in theSession
information- Returns:
- A new
SessionControl
object - Throws:
PermissionDeniedException
- If the userId is different from the currently logged in userItemNotFoundException
- If no user with the specified id existsBaseException
- If there is another error
-
getPluginSessionControl
Create a new session control for executing a plugin using the same parent as this session control has.- Overrides:
getPluginSessionControl
in classSessionControl
- Parameters:
plugin
- The plugin to executejob
- The job that executes the plug-in, or null- Returns:
- A plugin session control
-