From f48062488e2af9fdf40875d4fde7bd2d12d5cad6 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 2 Nov 2018 08:19:56 +0100 Subject: [PATCH] Add get endpoints for rights [AdminAPI] --- lib/pleroma/web/admin_api/admin_api_controller.ex | 7 +++++++ lib/pleroma/web/router.ex | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex index a7be3611f..17f5f320d 100644 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@ -56,6 +56,13 @@ def right_add(conn, %{"right" => right, "nickname" => nickname}) |> json(user.info) end + def right_get(conn, %{"nickname" => nickname}) do + user = User.get_by_nickname(nickname) + + conn + |> json(user.info) + end + def right_add(conn, _) do conn |> put_status(404) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 4d9422970..281e816c1 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -99,8 +99,10 @@ defmodule Pleroma.Web.Router do delete("/user", AdminAPIController, :user_delete) post("/user", AdminAPIController, :user_create) - post("/rights/:right/:nickname", AdminAPIController, :right_add) - delete("/rights/:right/:nickname", AdminAPIController, :right_delete) + get("/rights/:nickname", AdminAPIController, :right_get) + get("/rights/:nickname/:right", AdminAPIController, :right_get) + post("/rights/:nickname/:right", AdminAPIController, :right_add) + delete("/rights/:nickname/:right", AdminAPIController, :right_delete) post("/relay", AdminAPIController, :relay_follow) delete("/relay", AdminAPIController, :relay_unfollow)