mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-25 09:22:22 +00:00
b54dae7e15
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
20 lines
329 B
Elixir
20 lines
329 B
Elixir
defmodule MobilizonWeb.Context do
|
|
@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
|