Skip to content

Commit

Permalink
Rename AuthorizeStatsPlug -> AuthorizeSiteAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
ukutaht committed Jun 11, 2021
1 parent 71ffbd9 commit caeb923
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/plausible_web/controllers/site/membership_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ defmodule PlausibleWeb.Site.MembershipController do
@only_owner_is_allowed_to [:transfer_ownership_form, :transfer_ownership]

plug PlausibleWeb.RequireAccountPlug
plug PlausibleWeb.AuthorizeStatsPlug, [:owner] when action in @only_owner_is_allowed_to
plug PlausibleWeb.AuthorizeSiteAccess, [:owner] when action in @only_owner_is_allowed_to

plug PlausibleWeb.AuthorizeStatsPlug,
plug PlausibleWeb.AuthorizeSiteAccess,
[:owner, :admin] when action not in @only_owner_is_allowed_to

def invite_member_form(conn, %{"website" => site_domain}) do
Expand Down
2 changes: 1 addition & 1 deletion lib/plausible_web/controllers/site_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule PlausibleWeb.SiteController do

plug PlausibleWeb.RequireAccountPlug

plug PlausibleWeb.AuthorizeStatsPlug,
plug PlausibleWeb.AuthorizeSiteAccess,
[:owner, :admin] when action not in [:index, :new, :create_site]

def index(conn, params) do
Expand Down
2 changes: 1 addition & 1 deletion lib/plausible_web/controllers/stats_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule PlausibleWeb.StatsController do
alias Plausible.Stats.Clickhouse, as: Stats
alias Plausible.Stats.Query

plug PlausibleWeb.AuthorizeStatsPlug when action in [:stats, :csv_export]
plug PlausibleWeb.AuthorizeSiteAccess when action in [:stats, :csv_export]

def stats(%{assigns: %{site: site}} = conn, _params) do
has_pageviews = Stats.has_pageviews?(site)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule PlausibleWeb.AuthorizeStatsPlug do
defmodule PlausibleWeb.AuthorizeSiteAccess do
import Plug.Conn
use Plausible.Repo

Expand Down
2 changes: 1 addition & 1 deletion lib/plausible_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule PlausibleWeb.Router do
plug :accepts, ["json"]
plug PlausibleWeb.Firewall
plug :fetch_session
plug PlausibleWeb.AuthorizeStatsPlug
plug PlausibleWeb.AuthorizeSiteAccess
end

pipeline :public_api do
Expand Down

0 comments on commit caeb923

Please sign in to comment.