admin_api_controller.ex: Create
This commit is contained in:
parent
a960983815
commit
ee2e1328ad
|
@ -0,0 +1,25 @@
|
||||||
|
defmodule Pleroma.Web.AdminAPI.Controller do
|
||||||
|
use Pleroma.Web, :controller
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
action_fallback(:errors)
|
||||||
|
|
||||||
|
def user_delete(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_create(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
|
||||||
|
def relay_follow(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
|
||||||
|
def relay_unfollow(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_delete(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_delete(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|
end
|
||||||
|
end
|
|
@ -31,6 +31,21 @@ defmodule Pleroma.Web.Router do
|
||||||
plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
|
plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pipeline :admin_api do
|
||||||
|
plug(:accepts, ["json"])
|
||||||
|
plug(:fetch_session)
|
||||||
|
plug(Pleroma.Plugs.OAuthPlug)
|
||||||
|
plug(Pleroma.Plugs.BasicAuthDecoderPlug)
|
||||||
|
plug(Pleroma.Plugs.UserFetcherPlug)
|
||||||
|
plug(Pleroma.Plugs.SessionAuthenticationPlug)
|
||||||
|
plug(Pleroma.Plugs.LegacyAuthenticationPlug)
|
||||||
|
plug(Pleroma.Plugs.AuthenticationPlug)
|
||||||
|
plug(Pleroma.Plugs.UserEnabledPlug)
|
||||||
|
plug(Pleroma.Plugs.SetUserSessionIdPlug)
|
||||||
|
plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
|
||||||
|
plug(Pleroma.Plugs.UserIsAdminPlug)
|
||||||
|
end
|
||||||
|
|
||||||
pipeline :mastodon_html do
|
pipeline :mastodon_html do
|
||||||
plug(:accepts, ["html"])
|
plug(:accepts, ["html"])
|
||||||
plug(:fetch_session)
|
plug(:fetch_session)
|
||||||
|
@ -79,6 +94,24 @@ defmodule Pleroma.Web.Router do
|
||||||
get("/emoji", UtilController, :emoji)
|
get("/emoji", UtilController, :emoji)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do
|
||||||
|
pipe_through(:admin_api)
|
||||||
|
delete("/user", AdminAPIController, :user_delete)
|
||||||
|
post("/user", AdminAPIController, :user_create)
|
||||||
|
|
||||||
|
# Maybe put a "rights" endpoint instead?
|
||||||
|
post("/moderator", AdminAPIController, :moderator_make)
|
||||||
|
delete("/moderator", AdminAPIController, :moderator_unmake)
|
||||||
|
post("/admin", AdminAPIController, :admin_make)
|
||||||
|
delete("/admin", AdminAPIController, :admin_unmake)
|
||||||
|
|
||||||
|
post("/relay", AdminAPIController, :relay_follow)
|
||||||
|
delete("/relay", AdminAPIController, :relay_unfollow)
|
||||||
|
|
||||||
|
get("/invite_token", AdminAPIController, :get_invite_token)
|
||||||
|
get("/password_reset", AdminAPIController, :get_password_reset)
|
||||||
|
end
|
||||||
|
|
||||||
scope "/", Pleroma.Web.TwitterAPI do
|
scope "/", Pleroma.Web.TwitterAPI do
|
||||||
pipe_through(:pleroma_html)
|
pipe_through(:pleroma_html)
|
||||||
get("/ostatus_subscribe", UtilController, :remote_follow)
|
get("/ostatus_subscribe", UtilController, :remote_follow)
|
||||||
|
|
Loading…
Reference in New Issue