Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Don't show "Subscription" settings item when user role not permitted (#5341)

Adrian Gruntkowski3764a4799e7e
diff --git a/lib/plausible_web/controllers/settings_controller.ex b/lib/plausible_web/controllers/settings_controller.ex
index e7ef51d4ee..422151609a 100644
--- a/lib/plausible_web/controllers/settings_controller.ex
+++ b/lib/plausible_web/controllers/settings_controller.ex
@@ -12,7 +12,7 @@ defmodule PlausibleWeb.SettingsController do
[:owner, :admin] when action in [:update_team_name]
plug Plausible.Plugs.AuthorizeTeamAccess,
- [:owner, :admin, :billing] when action in [:invoices]
+ [:owner, :admin, :billing] when action in [:subscription, :invoices]
plug Plausible.Plugs.AuthorizeTeamAccess,
[:owner] when action in [:team_danger_zone, :delete_team]
diff --git a/lib/plausible_web/views/layout_view.ex b/lib/plausible_web/views/layout_view.ex
index ca80cdc6fe..733fdb82dc 100644
--- a/lib/plausible_web/views/layout_view.ex
+++ b/lib/plausible_web/views/layout_view.ex
@@ -124,7 +124,9 @@ defmodule PlausibleWeb.LayoutView do
"Team Settings",
[
%{key: "General", value: "team/general", icon: :adjustments_horizontal},
- %{key: "Subscription", value: "billing/subscription", icon: :circle_stack},
+ if(current_team_role in [:owner, :admin, :billing],
+ do: %{key: "Subscription", value: "billing/subscription", icon: :circle_stack}
+ ),
if(current_team_role in [:owner, :admin, :billing],
do: %{key: "Invoices", value: "billing/invoices", icon: :banknotes}
),