You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/11/13 21:13:59 UTC

[isis] 02/07: ISIS-1267: disables the logout menu

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 9d5d40a64e87969c58aa2360519026dff1ccbb67
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Oct 25 08:20:45 2019 +0100

    ISIS-1267: disables the logout menu
---
 .../serviceactions/TertiaryActionsPanel.java           | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
index 1975b3e..c9ac147 100644
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
+++ b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
@@ -22,8 +22,15 @@ import java.util.List;
 
 import javax.inject.Inject;
 
+import org.apache.isis.core.runtime.web.AuthenticationSessionWormhole;
+import org.apache.isis.metamodel.commons.Wormhole;
+import org.apache.isis.security.authentication.AuthenticationSession;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.Tooltips;
+import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.Page;
+import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
 import org.apache.wicket.markup.head.CssHeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.html.WebComponent;
@@ -92,6 +99,7 @@ public class TertiaryActionsPanel extends PanelBase {
     }
 
     private void addLogoutLink(MarkupContainer themeDiv) {
+
         Link<Void> logoutLink = new Link<Void>("logoutLink") {
 
             private static final long serialVersionUID = 1L;
@@ -104,6 +112,16 @@ public class TertiaryActionsPanel extends PanelBase {
 
         };
         themeDiv.add(logoutLink);
+
+        // this is hacky, would rather ask AuthenticatedWebSessionForIsis, but that type isn't visible here.
+        final AuthenticationSession authenticationSession = AuthenticationSessionWormhole.sessionByThread.get();
+        if(authenticationSession != null && authenticationSession.getType() == AuthenticationSession.Type.EXTERNAL) {
+            logoutLink.setEnabled(false);
+            // TODO: need to improve the styling, show as grayed out.
+            logoutLink.add(new CssClassAppender("disabled"));
+            Tooltips.addTooltip(logoutLink, "External");
+        }
+
     }
 
     private Class<? extends Page> getSignInPage() {