forked from AkkomaGang/akkoma
lib/pleroma/plugs/user_is_admin_plug.ex: Create
This commit is contained in:
parent
77d2fd54dd
commit
7076d45cb6
1 changed files with 17 additions and 0 deletions
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