mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-24 18:15:19 +00:00
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 a new issue