X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fplugs%2Fuser_is_admin_plug.ex;h=ee808f31f2f53988ff7bbfdeba61977171ad48e3;hb=43ea16870fe60578a6528e1f01bfaab68943a1bc;hp=cf22ce5d064602926db32e0820ea636f250472bb;hpb=1c67277c8031be2212d6faf84c143ac11462c87b;p=akkoma diff --git a/lib/pleroma/plugs/user_is_admin_plug.ex b/lib/pleroma/plugs/user_is_admin_plug.ex index cf22ce5d0..ee808f31f 100644 --- a/lib/pleroma/plugs/user_is_admin_plug.ex +++ b/lib/pleroma/plugs/user_is_admin_plug.ex @@ -1,4 +1,9 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Plugs.UserIsAdminPlug do + import Pleroma.Web.TranslationHelpers import Plug.Conn alias Pleroma.User @@ -6,14 +11,13 @@ defmodule Pleroma.Plugs.UserIsAdminPlug do options end - def call(%{assigns: %{user: %User{info: %{is_admin: true}}}} = conn, _) do + def call(%{assigns: %{user: %User{is_admin: true}}} = conn, _) do conn end def call(conn, _) do conn - |> put_resp_content_type("application/json") - |> send_resp(403, Jason.encode!(%{error: "User is not admin."})) + |> render_error(:forbidden, "User is not admin.") |> halt end end