If there is only one local Sone, always be logged in as it.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 21 Jan 2011 10:05:16 +0000 (11:05 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 21 Jan 2011 10:05:16 +0000 (11:05 +0100)
src/main/java/net/pterodactylus/sone/web/LogoutPage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index 23ccec0..f388368 100644 (file)
@@ -57,7 +57,7 @@ public class LogoutPage extends SoneTemplatePage {
         */
        @Override
        public boolean isEnabled(ToadletContext toadletContext) {
-               return getCurrentSone(toadletContext, false) != null;
+               return (getCurrentSone(toadletContext, false) != null) && (webInterface.getCore().getLocalSones().size() != 1);
        }
 
 }
index 13c7157..0df6d79 100644 (file)
@@ -309,6 +309,10 @@ public class WebInterface implements CoreListener {
         *         currently logged in
         */
        public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
+               Set<Sone> localSones = getCore().getLocalSones();
+               if (localSones.size() == 1) {
+                       return localSones.iterator().next();
+               }
                return getCurrentSone(getCurrentSession(toadletContext, create));
        }