From: Haelwenn (lanodan) Monnier Date: Fri, 12 Oct 2018 04:25:50 +0000 (+0200) Subject: [Pleroma.Plugs.UserIsAdminPlug]: Check if admin is true instead of false, fix error... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=c8b8f1d32c28e2a0ccf30f999c417b7739b9c445;p=akkoma [Pleroma.Plugs.UserIsAdminPlug]: Check if admin is true instead of false, fix error reporting --- diff --git a/lib/pleroma/plugs/user_is_admin_plug.ex b/lib/pleroma/plugs/user_is_admin_plug.ex index 2f812bf47..bdd057c44 100644 --- a/lib/pleroma/plugs/user_is_admin_plug.ex +++ b/lib/pleroma/plugs/user_is_admin_plug.ex @@ -6,12 +6,14 @@ defmodule Pleroma.Plugs.UserIsAdminPlug do options end - def call(%{assigns: %{user: %User{info: %{"is_admin" => false}}}} = conn, _) do + def call(%{assigns: %{user: %User{info: %{"is_admin" => true}}}} = conn, _) do conn - |> assign(:user, nil) end def call(conn, _) do conn + |> put_resp_content_type("application/json") + |> send_resp(403, Jason.encode!(%{error: "Not admin."})) + |> halt end end