Gate sidebar menu items by can_access_page?

Members, Fee Types and Administration subitems only shown when user
has page permission. Add admin_menu_visible? helper. Sidebar test
uses admin user so menu items render.
This commit is contained in:
Moritz 2026-02-03 16:35:35 +01:00
parent cc9e530d80
commit f779fd61e0
Signed by: moritz
GPG key ID: 1020A035E5DD0824
2 changed files with 51 additions and 23 deletions

View file

@ -22,9 +22,14 @@ defmodule MvWeb.Layouts.SidebarTest do
# =============================================================================
# Returns assigns for an authenticated user with all required attributes.
# User has admin role so can_access_page? returns true for all sidebar links.
defp authenticated_assigns(mobile \\ false) do
%{
current_user: %{id: "user-123", email: "test@example.com"},
current_user: %{
id: "user-123",
email: "test@example.com",
role: %{permission_set_name: "admin"}
},
club_name: "Test Club",
mobile: mobile
}