lib/pleroma/plugs/user_is_admin_plug.ex: Create
This commit is contained in:
parent
77d2fd54dd
commit
7076d45cb6
17
lib/pleroma/plugs/user_is_admin_plug.ex
Normal file
17
lib/pleroma/plugs/user_is_admin_plug.ex
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
defmodule Pleroma.Plugs.UserIsAdminPlug do
|
||||||
|
import Plug.Conn
|
||||||
|
alias Pleroma.User
|
||||||
|
|
||||||
|
def init(options) do
|
||||||
|
options
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(%{assigns: %{user: %User{info: %{"is_admin" => false}}}} = conn, _) do
|
||||||
|
conn
|
||||||
|
|> assign(:user, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(conn, _) do
|
||||||
|
conn
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user