Skip to content

Commit

Permalink
fix: dashboard not showing without re-logging in; fixes #25673
Browse files Browse the repository at this point in the history
The `DashboardBean` is used on the main `index.xhtml` and therefore already loaded and initialized before the user logs in. This leads a non-initialized dashboard. This commit re-initializes the dashboard plugin, if it fails to initialize when a user is not logged in.
  • Loading branch information
Dominick Leppich authored and janvonde committed Jan 20, 2024
1 parent 9dc6df1 commit 732ef90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Goobi/src/main/java/org/goobi/managedbeans/DashboardBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import org.apache.commons.lang3.StringUtils;
Expand All @@ -55,9 +58,10 @@ public class DashboardBean implements Serializable {
@Getter
private IDashboardPlugin plugin = null;

private boolean notInitializedYet = true;

@PostConstruct
public void initializePlugins() {

User user = Helper.getCurrentUser();
if (user != null) {
String pluginName = user.getDashboardPlugin();
Expand All @@ -69,10 +73,15 @@ public void initializePlugins() {
this.plugin = newPlugin;
}
}
notInitializedYet = false;
}
}

public String getPluginUi() {
if (notInitializedYet) {
initializePlugins();
}

if (plugin == null) {
return "";
}
Expand Down

0 comments on commit 732ef90

Please sign in to comment.