forked from AkkomaGang/akkoma
[Pleroma.Plugs.UserIsAdminPlug]: Check if admin is true instead of false, fix error reporting
This commit is contained in:
parent
011a2e36b1
commit
c8b8f1d32c
1 changed files with 4 additions and 2 deletions
|
@ -6,12 +6,14 @@ def init(options) do
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(%{assigns: %{user: %User{info: %{"is_admin" => false}}}} = conn, _) do
|
def call(%{assigns: %{user: %User{info: %{"is_admin" => true}}}} = conn, _) do
|
||||||
conn
|
conn
|
||||||
|> assign(:user, nil)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(conn, _) do
|
def call(conn, _) do
|
||||||
conn
|
conn
|
||||||
|
|> put_resp_content_type("application/json")
|
||||||
|
|> send_resp(403, Jason.encode!(%{error: "Not admin."}))
|
||||||
|
|> halt
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue