logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 42d4bd3a5d49a472b8fcb85e6cd413eb0d6dab3f
parent 15748fd30148b8188824bf10fac4c49b6821b041
Author: Ilja <ilja@ilja.space>
Date:   Sat,  2 Jul 2022 08:55:14 +0200

Rename pipelines and add forgotten tags

I renamed some tags before, but forgot to rename the pipelines
I also had some tags which I forgot to add to the config, description, etc.

These have now been done/added

Diffstat:

Mconfig/config.exs5++++-
Mconfig/description.exs10++++++++--
Mdocs/configuration/cheatsheet.md6++++++
Mlib/pleroma/web/router.ex56++++++++++++++++++++++++++++----------------------------
Mtest/pleroma/web/admin_api/controllers/admin_api_controller_test.exs4++--
Mtest/pleroma/web/admin_api/controllers/instance_controller_test.exs2+-
6 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/config/config.exs b/config/config.exs @@ -265,8 +265,11 @@ config :pleroma, :instance, :users_delete, :messages_read, :messages_delete, + :instances_delete, :reports_manage_reports, - :emoji_manage_emoji + :moderation_log_read, + :emoji_manage_emoji, + :statistics_read ], moderator_privileges: [], max_endorsed_users: 20, diff --git a/config/description.exs b/config/description.exs @@ -972,8 +972,11 @@ config :pleroma, :config_description, [ :users_delete, :messages_read, :messages_delete, + :instances_delete, :reports_manage_reports, - :emoji_manage_emoji + :moderation_log_read, + :emoji_manage_emoji, + :statistics_read ], description: "What extra privileges to allow admins (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)" @@ -990,8 +993,11 @@ config :pleroma, :config_description, [ :users_delete, :messages_read, :messages_delete, + :instances_delete, :reports_manage_reports, - :emoji_manage_emoji + :moderation_log_read, + :emoji_manage_emoji, + :statistics_read ], description: "What extra privileges to allow moderators (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)" diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md @@ -82,10 +82,16 @@ To add configuration to your config file, you can copy it from the base config. * Allows you to view messages through the Admin-API, including non-public posts and chats * `:messages_delete` * Allows you to delete messages from otehr people + * `:instances_delete,` + * Allows you to delete a whole remote instance from your instance. This will delete all users and messages from that remote instance. * `:reports_manage_reports` * Allows you to see and manage reports + * `:moderation_log_read,` + * Allows you to read the entries in the moderation log * `:emoji_manage_emoji` * Allows you to manage emoji on your instance + * `:statistics_read,` + * Allows you to see some simple statistics from your instance * `moderator_privileges`: A list of privileges a moderator has (e.g. delete messages, manage reports...) * Possible values are the same as for `admin_privileges` diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex @@ -105,59 +105,59 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.UserIsAdminPlug) end - pipeline :require_privileged_role_user_deletion do + pipeline :require_privileged_role_users_delete do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_delete) end - pipeline :require_privileged_role_user_credentials do + pipeline :require_privileged_role_users_manage_credentials do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_credentials) end - pipeline :require_privileged_role_statuses_read do + pipeline :require_privileged_role_messages_read do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_read) end - pipeline :require_privileged_role_user_tag do + pipeline :require_privileged_role_users_manage_tags do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_tags) end - pipeline :require_privileged_role_user_activation do + pipeline :require_privileged_role_users_manage_activation_state do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_activation_state) end - pipeline :require_privileged_role_user_invite do + pipeline :require_privileged_role_users_manage_invites do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_invites) end - pipeline :require_privileged_role_report_handle do + pipeline :require_privileged_role_reports_manage_reports do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :reports_manage_reports) end - pipeline :require_privileged_role_user_read do + pipeline :require_privileged_role_users_read do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_read) end - pipeline :require_privileged_role_status_delete do + pipeline :require_privileged_role_messages_delete do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_delete) end - pipeline :require_privileged_role_emoji_management do + pipeline :require_privileged_role_emoji_manage_emoji do plug(:admin_api) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :emoji_manage_emoji) end - pipeline :require_privileged_role_instance_delete do + pipeline :require_privileged_role_instances_delete do plug(:admin_api) - plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :instance_delete) + plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :instances_delete) end pipeline :require_privileged_role_moderation_log_read do @@ -165,9 +165,9 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :moderation_log_read) end - pipeline :require_privileged_role_stats_read do + pipeline :require_privileged_role_statistics_read do plug(:admin_api) - plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :stats_read) + plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :statistics_read) end pipeline :pleroma_html do @@ -293,14 +293,14 @@ defmodule Pleroma.Web.Router do # 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_user_deletion) + pipe_through(:require_privileged_role_users_delete) delete("/users", UserController, :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_user_credentials) + pipe_through(:require_privileged_role_users_manage_credentials) get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset) patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials) @@ -308,7 +308,7 @@ defmodule Pleroma.Web.Router do # 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_statuses_read) + pipe_through(:require_privileged_role_messages_read) get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses) get("/users/:nickname/chats", AdminAPIController, :list_user_chats) @@ -325,7 +325,7 @@ defmodule Pleroma.Web.Router do # 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_user_tag) + pipe_through(:require_privileged_role_users_manage_tags) put("/users/tag", AdminAPIController, :tag_users) delete("/users/tag", AdminAPIController, :untag_users) @@ -333,7 +333,7 @@ defmodule Pleroma.Web.Router do # 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_user_activation) + pipe_through(:require_privileged_role_users_manage_activation_state) patch("/users/:nickname/toggle_activation", UserController, :toggle_activation) patch("/users/activate", UserController, :activate) @@ -342,7 +342,7 @@ defmodule Pleroma.Web.Router do # 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_user_invite) + pipe_through(:require_privileged_role_users_manage_invites) patch("/users/approve", UserController, :approve) post("/users/invite_token", InviteController, :create) @@ -353,7 +353,7 @@ defmodule Pleroma.Web.Router do # 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_report_handle) + pipe_through(:require_privileged_role_reports_manage_reports) get("/reports", ReportController, :index) get("/reports/:id", ReportController, :show) @@ -364,7 +364,7 @@ defmodule Pleroma.Web.Router do # 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_user_read) + pipe_through(:require_privileged_role_users_read) get("/users", UserController, :index) get("/users/:nickname", UserController, :show) @@ -372,7 +372,7 @@ defmodule Pleroma.Web.Router do # 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_status_delete) + pipe_through(:require_privileged_role_messages_delete) put("/statuses/:id", StatusController, :update) delete("/statuses/:id", StatusController, :delete) @@ -382,14 +382,14 @@ defmodule Pleroma.Web.Router do # 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_emoji_management) + pipe_through(:require_privileged_role_emoji_manage_emoji) post("/reload_emoji", AdminAPIController, :reload_emoji) 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_instance_delete) + pipe_through(:require_privileged_role_instances_delete) delete("/instances/:instance", InstanceController, :delete) end @@ -403,14 +403,14 @@ defmodule Pleroma.Web.Router do # 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) + pipe_through(:require_privileged_role_statistics_read) get("/stats", AdminAPIController, :stats) end scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do scope "/pack" do - pipe_through(:require_privileged_role_emoji_management) + pipe_through(:require_privileged_role_emoji_manage_emoji) post("/", EmojiPackController, :create) patch("/", EmojiPackController, :update) @@ -425,7 +425,7 @@ defmodule Pleroma.Web.Router do # Modifying packs scope "/packs" do - pipe_through(:require_privileged_role_emoji_management) + pipe_through(:require_privileged_role_emoji_manage_emoji) get("/import", EmojiPackController, :import_from_filesystem) get("/remote", EmojiPackController, :remote) diff --git a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs @@ -971,7 +971,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do describe "/api/pleroma/admin/stats" do setup do - clear_config([:instance, :admin_privileges], [:stats_read]) + clear_config([:instance, :admin_privileges], [:statistics_read]) end test "status visibility count", %{conn: conn} do @@ -1007,7 +1007,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do response["status_visibility"] end - test "it requires privileged role :stats_read", %{conn: conn} do + test "it requires privileged role :statistics_read", %{conn: conn} do clear_config([:instance, :admin_privileges], []) assert conn diff --git a/test/pleroma/web/admin_api/controllers/instance_controller_test.exs b/test/pleroma/web/admin_api/controllers/instance_controller_test.exs @@ -68,7 +68,7 @@ defmodule Pleroma.Web.AdminAPI.InstanceControllerTest do end test "DELETE /instances/:instance", %{conn: conn} do - clear_config([:instance, :admin_privileges], [:instance_delete]) + clear_config([:instance, :admin_privileges], [:instances_delete]) user = insert(:user, nickname: "lain@lain.com") post = insert(:note_activity, user: user)