From 23d4011baca878a5d887883c80f725f7b3c3125f Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Fri, 13 Jan 2023 23:52:12 +0100
Subject: [PATCH] Fix menu generation for logged-out users

---
 aleksis/core/assets/App.vue            | 5 +++--
 aleksis/core/assets/routeValidators.js | 2 +-
 aleksis/core/assets/routes.js          | 3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/aleksis/core/assets/App.vue b/aleksis/core/assets/App.vue
index 8e525db87..8882765d0 100644
--- a/aleksis/core/assets/App.vue
+++ b/aleksis/core/assets/App.vue
@@ -454,12 +454,12 @@ export default {
       this.accountMenu = this.buildMenu(
         this.$router.getRoutes(),
         "inAccountMenu",
-        this.whoAmI.permissions
+        this.whoAmI ? this.whoAmI.permissions : []
       );
       this.sideNavMenu = this.buildMenu(
         this.$router.getRoutes(),
         "inMenu",
-        this.whoAmI.permissions
+        this.whoAmI ? this.whoAmI.permissions : []
       );
     },
   },
@@ -517,6 +517,7 @@ export default {
   },
   mounted() {
     this.$router.onReady(this.getPermissionNames);
+    this.buildMenus();
   },
   name: "App",
   components: {
diff --git a/aleksis/core/assets/routeValidators.js b/aleksis/core/assets/routeValidators.js
index 5226209a5..5db527310 100644
--- a/aleksis/core/assets/routeValidators.js
+++ b/aleksis/core/assets/routeValidators.js
@@ -1,5 +1,5 @@
 const notLoggedInValidator = (whoAmI) => {
-  return !whoAmI;
+  return !whoAmI || whoAmI.isAnonymous;
 };
 
 export { notLoggedInValidator };
diff --git a/aleksis/core/assets/routes.js b/aleksis/core/assets/routes.js
index a69cb07c4..3c5b874ee 100644
--- a/aleksis/core/assets/routes.js
+++ b/aleksis/core/assets/routes.js
@@ -15,7 +15,6 @@ const routes = [
       inMenu: true,
       icon: "mdi-login-variant",
       titleKey: "accounts.login.menu_title",
-      permission: "core.login_rule",
       validators: [notLoggedInValidator],
     },
   },
@@ -27,7 +26,6 @@ const routes = [
       inMenu: true,
       icon: "mdi-account-plus-outline",
       titleKey: "accounts.signup.menu_title",
-      permission: "core.signup_rule",
       validators: [notLoggedInValidator],
     },
   },
@@ -39,7 +37,6 @@ const routes = [
       inMenu: true,
       icon: "mdi-key-outline",
       titleKey: "accounts.invitation.accept_invitation.menu_title",
-      permission: "core.accept_invite_rule",
       validators: [notLoggedInValidator],
     },
   },
-- 
GitLab