2f2c538cc9
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Make Logger.debug calls lazy Signed-off-by: Thomas Citharel <tcit@tcit.fr> Add missing @moduledocs Signed-off-by: Thomas Citharel <tcit@tcit.fr> Refactor according to credo Signed-off-by: Thomas Citharel <tcit@tcit.fr> Final fixes and add credo to CI Signed-off-by: Thomas Citharel <tcit@tcit.fr> Closes #52
24 lines
388 B
Elixir
24 lines
388 B
Elixir
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
|