1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Plugs.EnsureStaffPrivilegedPlug do
7 Ensures staff are privileged enough to do certain tasks.
9 import Pleroma.Web.TranslationHelpers
19 def call(%{assigns: %{user: %User{is_admin: true}}} = conn, _), do: conn
21 def call(%{assigns: %{user: %User{is_moderator: true}}} = conn, _) do
22 if Config.get!([:instance, :privileged_staff]) do
26 |> render_error(:forbidden, "User is not an admin.")
33 |> render_error(:forbidden, "User is not a staff member.")