lib/pleroma/plugs/user_is_admin_plug.ex: Create

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-10-02 19:13:21 +02:00
parent 77d2fd54dd
commit 7076d45cb6
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE

View File

@ -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