projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into feature/admin-api-list-statuses-for-a-given-instance
[akkoma]
/
lib
/
pleroma
/
plugs
/
user_is_admin_plug.ex
diff --git
a/lib/pleroma/plugs/user_is_admin_plug.ex
b/lib/pleroma/plugs/user_is_admin_plug.ex
index bdd057c44b4c6ff2fa331c4a6569706ff9bd2db3..ee808f31f2f53988ff7bbfdeba61977171ad48e3 100644
(file)
--- a/
lib/pleroma/plugs/user_is_admin_plug.ex
+++ b/
lib/pleroma/plugs/user_is_admin_plug.ex
@@
-1,4
+1,9
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Plugs.UserIsAdminPlug do
defmodule Pleroma.Plugs.UserIsAdminPlug do
+ import Pleroma.Web.TranslationHelpers
import Plug.Conn
alias Pleroma.User
import Plug.Conn
alias Pleroma.User
@@
-6,14
+11,13
@@
defmodule Pleroma.Plugs.UserIsAdminPlug do
options
end
options
end
- def call(%{assigns: %{user: %User{i
nfo: %{"is_admin" => true}
}}} = conn, _) do
+ def call(%{assigns: %{user: %User{i
s_admin: true
}}} = conn, _) do
conn
end
def call(conn, _) do
conn
conn
end
def call(conn, _) do
conn
- |> put_resp_content_type("application/json")
- |> send_resp(403, Jason.encode!(%{error: "Not admin."}))
+ |> render_error(:forbidden, "User is not admin.")
|> halt
end
end
|> halt
end
end