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 2f812bf47611fb26978196f082b193a7be682628..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,12
+11,13
@@
defmodule Pleroma.Plugs.UserIsAdminPlug do
options
end
options
end
- def call(%{assigns: %{user: %User{i
nfo: %{"is_admin" => false}
}}} = conn, _) do
+ def call(%{assigns: %{user: %User{i
s_admin: true
}}} = 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