akkoma/lib/pleroma/plugs/user_is_admin_plug.ex
2018-11-17 20:25:52 +01:00

17 lines
292 B
Elixir

defmodule Pleroma.Plugs.UserIsAdminPlug do
import Plug.Conn
alias Pleroma.User
def init(options) do
options
end
def call(%{assigns: %{user: %User{info: %{"is_admin" => false}}}} = conn, _) do
conn
|> assign(:user, nil)
end
def call(conn, _) do
conn
end
end