Enable superadmin access to funnel settings (#3104)

pull/3109/head
hq1 3 years ago committed by GitHub
parent f374650330
commit e98a16141e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,7 +15,13 @@ defmodule PlausibleWeb.Live.FunnelSettings do
socket
) do
true = Plausible.Funnels.enabled_for?("user:#{user_id}")
site = Sites.get_for_user!(user_id, domain, [:owner, :admin])
site =
if Plausible.Auth.is_super_admin?(user_id) do
Sites.get_by_domain(domain)
else
Sites.get_for_user!(user_id, domain, [:owner, :admin])
end
funnels = Funnels.list(site)
goal_count = Goals.count(site)

@ -12,7 +12,12 @@ defmodule PlausibleWeb.Live.FunnelSettings.Form do
alias Plausible.{Sites, Goals}
def mount(_params, %{"current_user_id" => user_id, "domain" => domain}, socket) do
site = Sites.get_for_user!(user_id, domain, [:owner, :admin])
site =
if Plausible.Auth.is_super_admin?(user_id) do
Sites.get_by_domain(domain)
else
Sites.get_for_user!(user_id, domain, [:owner, :admin])
end
# We'll have the options trimmed to only the data we care about, to keep
# it minimal at the socket assigns, yet, we want to retain specific %Goal{}

Loading…
Cancel
Save