From: Haelwenn (lanodan) Monnier Date: Tue, 2 Oct 2018 17:13:21 +0000 (+0200) Subject: lib/pleroma/plugs/user_is_admin_plug.ex: Create X-Git-Url: http://git.squeep.com/?a=commitdiff_plain;h=7076d45cb6661731201a0224628b748a0f6782e8;p=akkoma lib/pleroma/plugs/user_is_admin_plug.ex: Create --- diff --git a/lib/pleroma/plugs/user_is_admin_plug.ex b/lib/pleroma/plugs/user_is_admin_plug.ex new file mode 100644 index 000000000..2f812bf47 --- /dev/null +++ b/lib/pleroma/plugs/user_is_admin_plug.ex @@ -0,0 +1,17 @@ +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