refactor(web): extract shared current_actor controller helper
This commit is contained in:
parent
561779e704
commit
1adf6aa664
4 changed files with 28 additions and 20 deletions
|
|
@ -13,11 +13,12 @@ defmodule MvWeb.ImportTemplateController do
|
|||
"""
|
||||
use MvWeb, :controller
|
||||
|
||||
alias Mv.Authorization.Actor
|
||||
alias Mv.Membership.Member
|
||||
alias Mv.Membership.MembersCSV
|
||||
alias MvWeb.Authorization
|
||||
|
||||
import MvWeb.ControllerHelpers, only: [current_actor: 1]
|
||||
|
||||
# Standard member columns in template order, with their English and German headers
|
||||
# and a placeholder example value. Groups and fee type are importable extras.
|
||||
@columns [
|
||||
|
|
@ -105,11 +106,6 @@ defmodule MvWeb.ImportTemplateController do
|
|||
end
|
||||
end
|
||||
|
||||
defp current_actor(conn) do
|
||||
conn.assigns[:current_user]
|
||||
|> Actor.ensure_loaded()
|
||||
end
|
||||
|
||||
defp return_forbidden(conn) do
|
||||
conn
|
||||
|> put_status(403)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue