Remove _misskey_reaction matching (#500)
[akkoma] / lib / pleroma / web / plugs / user_is_admin_plug.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Plugs.UserIsAdminPlug do
6 import Pleroma.Web.TranslationHelpers
7 import Plug.Conn
8
9 alias Pleroma.User
10
11 def init(options) do
12 options
13 end
14
15 def call(%{assigns: %{user: %User{is_admin: true}}} = conn, _) do
16 conn
17 end
18
19 def call(conn, _) do
20 conn
21 |> render_error(:forbidden, "User is not an admin.")
22 |> halt()
23 end
24 end