From: Roland Haeder Date: Fri, 16 Oct 2015 11:36:30 +0000 (+0200) Subject: init() doesn't work with guests, so forbid it here + used address book instance from... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=21c4456f647952dd99e9b45d607cc004c00eeb30;p=addressbook-war.git init() doesn't work with guests, so forbid it here + used address book instance from "share" Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/addressbook/beans/shares/SharesWebBean.java b/src/java/org/mxchange/addressbook/beans/shares/SharesWebBean.java index 288e4c4a..bfb768d3 100644 --- a/src/java/org/mxchange/addressbook/beans/shares/SharesWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/shares/SharesWebBean.java @@ -185,6 +185,12 @@ public class SharesWebBean implements SharesWebController { @PostConstruct public void init () { + // Check conditions + if (!this.loginController.isUserLoggedIn()) { + // No, then throw exception + throw new FaceletException("This method can only be called as logged-in user."); //NOI18N + } + // Init share list this.sharedAddressbooks = this.shareBean.allSharedAddressbooks(this.loginController.getLoggedInUser()); } diff --git a/web/login/login_shared_addressbooks.xhtml b/web/login/login_shared_addressbooks.xhtml index ed84ff92..2f6ba09a 100644 --- a/web/login/login_shared_addressbooks.xhtml +++ b/web/login/login_shared_addressbooks.xhtml @@ -25,7 +25,7 @@ #{msg.SHARED_ADDRESSBOOK} - +