logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: c38ce20a5d666e861b29fcce07ea80865ec7315d
parent 28a2e3650dbdfff61ea5b72f34a2625691196dfc
Author: Lain Soykaf <lain@lain.com>
Date:   Sun, 20 Jul 2025 21:33:39 +0400

AdminApiController: Reorder functions to fix admin revocation

Diffstat:

Mlib/pleroma/web/admin_api/controllers/admin_api_controller.ex8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -240,6 +240,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do render_error(conn, :not_found, "No such permission_group") end + def right_delete(%{assigns: %{user: %{nickname: nickname}}} = conn, %{"nickname" => nickname}) do + render_error(conn, :forbidden, "You can't revoke your own admin status.") + end + def right_delete( %{assigns: %{user: admin}} = conn, %{ @@ -265,10 +269,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do json(conn, fields) end - def right_delete(%{assigns: %{user: %{nickname: nickname}}} = conn, %{"nickname" => nickname}) do - render_error(conn, :forbidden, "You can't revoke your own admin status.") - end - @doc "Get a password reset token (base64 string) for given nickname" def get_password_reset(conn, %{"nickname" => nickname}) do (%User{local: true} = user) = User.get_cached_by_nickname(nickname)