mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-30 09:02:28 +00:00
[Pleroma.Plugs.UserIsAdminPlug]: Check if admin is true instead of false, fix error reporting
This commit is contained in:
parent
011a2e36b1
commit
c8b8f1d32c
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue