Skip to content

Commit

Permalink
Fix ListingSessionClientST
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Mar 11, 2024
1 parent dcb4f7f commit 05915a9
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import javax.faces.context.FacesContext;
import javax.inject.Named;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kitodo.data.database.beans.Client;
import org.kitodo.data.database.beans.User;
import org.kitodo.data.database.exceptions.DAOException;
import org.kitodo.data.exceptions.DataException;
Expand All @@ -32,9 +35,9 @@
@Named("LoginForm")
@SessionScoped
public class LoginForm implements Serializable {
private static final Logger logger = LogManager.getLogger(LoginForm.class);
private User loggedUser;
private boolean firstVisit = true;
private static final String INDEXING_PAGE = "system.jsf?tabIndex=";
private static final String DESKTOP_VIEW = "desktop.jsf";
private final SecurityAccessService securityAccessService = ServiceManager.getSecurityAccessService();

Expand Down Expand Up @@ -100,20 +103,13 @@ public void performPostLoginChecks() throws DataException, DAOException, IOExcep
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
SessionClientController controller = new SessionClientController();

if (ServiceManager.getSecurityAccessService().hasAuthorityToEditIndex()) {
if (controller.getAvailableClientsOfCurrentUser().size() > 1
&& Objects.isNull(controller.getCurrentSessionClient())) {
controller.showClientSelectDialog();
} else {
redirect(context);
}
int availableClients = controller.getAvailableClientsOfCurrentUser().size();
Client currentClient = controller.getCurrentSessionClient();
logger.debug("availableClients:" + availableClients + ", currentClient: " + currentClient);
if (availableClients > 1 && Objects.isNull(currentClient)) {
controller.showClientSelectDialog();
} else {
if (controller.getAvailableClientsOfCurrentUser().size() > 1
&& Objects.isNull(controller.getCurrentSessionClient())) {
controller.showClientSelectDialog();
} else {
redirect(context);
}
redirect(context);
}
}

Expand Down

0 comments on commit 05915a9

Please sign in to comment.