diff options
author | Ilja <ilja@ilja.space> | 2022-06-12 10:07:33 +0200 |
---|---|---|
committer | Ilja <ilja@ilja.space> | 2022-06-21 12:10:27 +0200 |
commit | c842e6267545dfa88cf97cef69337296c3cb77d5 (patch) | |
tree | 53b7155578d8a72531a0dafe094fd3e4bbf02be6 /lib | |
parent | ecd42a2ce112489bb09cadcffc3661314a37a7fa (diff) | |
download | pleroma-c842e6267545dfa88cf97cef69337296c3cb77d5.tar.gz pleroma-c842e6267545dfa88cf97cef69337296c3cb77d5.zip |
Add last priviliges
I still had three endpoints I didn't really know what to do with them. I added them under separate tags
* :instance_delete
* :moderation_log_read
* :stats_read
I also checked and these are the last changes done by MR https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3480/diffs this is trying to fix
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/router.ex | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 46f128672..f680c8353 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -155,6 +155,21 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :emoji_management) end + pipeline :require_privileged_role_instance_delete do + plug(:admin_api) + plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :instance_delete) + end + + pipeline :require_privileged_role_moderation_log_read do + plug(:admin_api) + plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :moderation_log_read) + end + + pipeline :require_privileged_role_stats_read do + plug(:admin_api) + plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :stats_read) + end + pipeline :pleroma_html do plug(:browser) plug(:authenticate) @@ -372,13 +387,23 @@ defmodule Pleroma.Web.Router do post("/reload_emoji", AdminAPIController, :reload_emoji) end - # AdminAPI: admins and mods (staff) can perform these actions + # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do - pipe_through(:admin_api) + pipe_through(:require_privileged_role_instance_delete) delete("/instances/:instance", InstanceController, :delete) + end + + # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) + scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do + pipe_through(:require_privileged_role_moderation_log_read) get("/moderation_log", AdminAPIController, :list_log) + end + + # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) + scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do + pipe_through(:require_privileged_role_stats_read) get("/stats", AdminAPIController, :stats) end |