mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-11-15 20:36:44 +01: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 New Issue
Block a user