1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-27 10:19:59 +00:00
mobilizon/lib/mobilizon_web/context.ex

24 lines
388 B
Elixir
Raw Normal View History

defmodule MobilizonWeb.Context do
@moduledoc """
Guardian context for MobilizonWeb
"""
@behaviour Plug
import Plug.Conn
require Logger
def init(opts) do
opts
end
def call(conn, _) do
case Guardian.Plug.current_resource(conn) do
nil ->
conn
user ->
put_private(conn, :absinthe, %{context: %{current_user: user}})
end
end
end