Package io.jmix.flowui.action.security
Class SubstituteUserAction
java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction
io.jmix.flowui.action.security.SubstituteUserAction
- All Implemented Interfaces:
ExecutableAction,Action,HasShortcutCombination,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@ActionType("substituteUser")
public class SubstituteUserAction
extends BaseAction
implements ExecutableAction, org.springframework.context.ApplicationContextAware
Makes UI-specific preparations to user substitution and performs it using
UserSubstitutionManager
Checks if there are unsaved changes on the current view and shows dialog with options:
- Discard changes (close current view, cleanups background tasks, then performs
substitution and navigates to
MainView) - Cancel (invokes all
cancelActions)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected Dialogsstatic final Stringprotected Stringprotected Messagesprotected org.springframework.security.core.userdetails.UserDetailsprotected org.springframework.security.core.userdetails.UserDetailsprotected jakarta.servlet.ServletContextprotected UserSubstitutionManagerprotected ViewRegistryFields inherited from class io.jmix.flowui.kit.action.BaseAction
enabledExplicitly, visibleExplicitlyFields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visibleFields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerform(com.vaadin.flow.component.Component component) protected voiddoCancel()protected voidvoidexecute()Executes theActionprotected Stringprotected voidopenDiscardCurrentViewDialog(View<?> view) protected voidprepareViewToClose(View<?> view) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetDialogs(Dialogs dialogs) voidsetMessages(Messages messages) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidsetUiProperties(UiProperties uiProperties) voidsetUserSubstitutionManager(UserSubstitutionManager userSubstitutionManager) voidsetViewRegistry(ViewRegistry viewRegistry) withCancelHandler(Consumer<org.springframework.security.core.userdetails.UserDetails> cancelHandler) withUsers(org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser, org.springframework.security.core.userdetails.UserDetails newSubstitutedUser) Methods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, isApplicable, refreshState, setEnabled, setEnabledInternal, setVisible, setVisibleInternal, withEnabled, withHandler, withIcon, withIcon, withShortcutCombination, withText, withTitle, withVariant, withVisibleMethods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setShortcutCombination, setText, setVariantMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.flowui.kit.action.Action
addPropertyChangeListener, getDescription, getIcon, getId, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setText, setVariant, setVisibleMethods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
ID
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
servletContext
protected jakarta.servlet.ServletContext servletContext -
userSubstitutionManager
-
viewRegistry
-
dialogs
-
messages
-
mainViewId
-
cancelHandlers
-
newSubstitutedUser
protected org.springframework.security.core.userdetails.UserDetails newSubstitutedUser -
prevSubstitutedUser
protected org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser
-
-
Constructor Details
-
SubstituteUserAction
public SubstituteUserAction() -
SubstituteUserAction
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setServletContext
@Autowired public void setServletContext(jakarta.servlet.ServletContext servletContext) -
setUserSubstitutionManager
-
setViewRegistry
-
setDialogs
-
setMessages
-
setUiProperties
-
actionPerform
public void actionPerform(com.vaadin.flow.component.Component component) - Specified by:
actionPerformin interfaceAction- Overrides:
actionPerformin classBaseAction
-
execute
public void execute()Description copied from interface:ExecutableActionExecutes theAction- Specified by:
executein interfaceExecutableAction
-
prepareViewToClose
-
openDiscardCurrentViewDialog
-
findCurrentOpenedView
-
doSubstituteUser
protected void doSubstituteUser() -
doCancel
protected void doCancel() -
getMainViewLocation
-
withUsers
public SubstituteUserAction withUsers(org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser, org.springframework.security.core.userdetails.UserDetails newSubstitutedUser) -
withCancelHandler
public SubstituteUserAction withCancelHandler(Consumer<org.springframework.security.core.userdetails.UserDetails> cancelHandler)
-