Skip to content

Commit

Permalink
Merge pull request #4894 from inception-project/bugfix/4892-Curation-…
Browse files Browse the repository at this point in the history
…sidebar-state-not-cleared-when-logging-out

#4892 - Curation sidebar state not cleared when logging out
  • Loading branch information
reckart authored Jun 23, 2024
2 parents 5dfe9f0 + 3c97258 commit f142570
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,9 @@ public void setSuspended(String aSessionOwner, Project aProject, boolean aState)
}
}

@EventListener
// Set order so this is handled before session info is removed from sessionRegistry
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
public void onSessionDestroyed(SessionDestroyedEvent event)
{
var info = sessionRegistry.getSessionInformation(event.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ public void afterProjectRemoved(AfterProjectRemovedEvent aEvent) throws IOExcept
deletionPending.remove(aEvent.getProject());
}

@EventListener
// Set order so this is handled before session info is removed from sessionRegistry
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
public void onSessionDestroyed(SessionDestroyedEvent event)
{
LOG.debug("Cleaning up tasks on session destroyed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.core.session.SessionDestroyedEvent;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -374,6 +376,8 @@ public void setDefaultSelectedUsersForDocument(String aSessionOwner, SourceDocum
listCuratableUsers(aSessionOwner, aDocument));
}

// Set order so this is handled before session info is removed from sessionRegistry
@Order(Ordered.HIGHEST_PRECEDENCE)
@EventListener
@Transactional
public void onSessionDestroyed(SessionDestroyedEvent event)
Expand Down Expand Up @@ -448,9 +452,9 @@ private void storeCurationSettings(User aSessionOwner)

private void closeAllSessions(User aSessionOwner)
{
projectService.listAccessibleProjects(aSessionOwner).stream() //
.map(Project::getId) //
.forEach(pId -> closeSession(aSessionOwner.getUsername(), pId));
synchronized (sessions) {
sessions.keySet().removeIf(k -> k.username.equals(aSessionOwner.getUsername()));
}
}

@Transactional
Expand Down

0 comments on commit f142570

Please sign in to comment.