projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make activity announceable by its author.
[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 2f812bf47611fb26978196f082b193a7be682628..4c4b3d610c15ec69e07cd7d2ea63b46d1bc4df68 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,12
+11,13
@@
defmodule Pleroma.Plugs.UserIsAdminPlug do
options
end
options
end
- def call(%{assigns: %{user: %User{info: %{
"is_admin" => fals
e}}}} = conn, _) do
+ def call(%{assigns: %{user: %User{info: %{
is_admin: tru
e}}}} = conn, _) do
conn
conn
- |> assign(:user, nil)
end
def call(conn, _) do
conn
end
def call(conn, _) do
conn
+ |> render_error(:forbidden, "User is not admin.")
+ |> halt
end
end
end
end