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
This commit is contained in:
Ilja 2022-07-02 08:55:14 +02:00
parent 15748fd301
commit 42d4bd3a5d
6 changed files with 49 additions and 34 deletions

View file

@ -265,8 +265,11 @@ config :pleroma, :instance,
:users_delete, :users_delete,
:messages_read, :messages_read,
:messages_delete, :messages_delete,
:instances_delete,
:reports_manage_reports, :reports_manage_reports,
:emoji_manage_emoji :moderation_log_read,
:emoji_manage_emoji,
:statistics_read
], ],
moderator_privileges: [], moderator_privileges: [],
max_endorsed_users: 20, max_endorsed_users: 20,

View file

@ -972,8 +972,11 @@ config :pleroma, :config_description, [
:users_delete, :users_delete,
:messages_read, :messages_read,
:messages_delete, :messages_delete,
:instances_delete,
:reports_manage_reports, :reports_manage_reports,
:emoji_manage_emoji :moderation_log_read,
:emoji_manage_emoji,
:statistics_read
], ],
description: 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)" "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, :users_delete,
:messages_read, :messages_read,
:messages_delete, :messages_delete,
:instances_delete,
:reports_manage_reports, :reports_manage_reports,
:emoji_manage_emoji :moderation_log_read,
:emoji_manage_emoji,
:statistics_read
], ],
description: 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)" "What extra privileges to allow moderators (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"

View file

@ -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 * Allows you to view messages through the Admin-API, including non-public posts and chats
* `:messages_delete` * `:messages_delete`
* Allows you to delete messages from otehr people * 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` * `:reports_manage_reports`
* Allows you to see and 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` * `:emoji_manage_emoji`
* Allows you to manage emoji on your instance * 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...) * `moderator_privileges`: A list of privileges a moderator has (e.g. delete messages, manage reports...)
* Possible values are the same as for `admin_privileges` * Possible values are the same as for `admin_privileges`

View file

@ -105,59 +105,59 @@ defmodule Pleroma.Web.Router do
plug(Pleroma.Web.Plugs.UserIsAdminPlug) plug(Pleroma.Web.Plugs.UserIsAdminPlug)
end end
pipeline :require_privileged_role_user_deletion do pipeline :require_privileged_role_users_delete do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_delete) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_delete)
end end
pipeline :require_privileged_role_user_credentials do pipeline :require_privileged_role_users_manage_credentials do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_credentials) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_credentials)
end end
pipeline :require_privileged_role_statuses_read do pipeline :require_privileged_role_messages_read do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_read) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_read)
end end
pipeline :require_privileged_role_user_tag do pipeline :require_privileged_role_users_manage_tags do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_tags) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_tags)
end end
pipeline :require_privileged_role_user_activation do pipeline :require_privileged_role_users_manage_activation_state do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_activation_state) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_activation_state)
end end
pipeline :require_privileged_role_user_invite do pipeline :require_privileged_role_users_manage_invites do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_invites) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_manage_invites)
end end
pipeline :require_privileged_role_report_handle do pipeline :require_privileged_role_reports_manage_reports do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :reports_manage_reports) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :reports_manage_reports)
end end
pipeline :require_privileged_role_user_read do pipeline :require_privileged_role_users_read do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_read) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :users_read)
end end
pipeline :require_privileged_role_status_delete do pipeline :require_privileged_role_messages_delete do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_delete) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :messages_delete)
end end
pipeline :require_privileged_role_emoji_management do pipeline :require_privileged_role_emoji_manage_emoji do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :emoji_manage_emoji) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :emoji_manage_emoji)
end end
pipeline :require_privileged_role_instance_delete do pipeline :require_privileged_role_instances_delete do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :instance_delete) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :instances_delete)
end end
pipeline :require_privileged_role_moderation_log_read do 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) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :moderation_log_read)
end end
pipeline :require_privileged_role_stats_read do pipeline :require_privileged_role_statistics_read do
plug(:admin_api) plug(:admin_api)
plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :stats_read) plug(Pleroma.Web.Plugs.EnsurePrivilegedPlug, :statistics_read)
end end
pipeline :pleroma_html do 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) delete("/users", UserController, :delete)
end end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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/statuses", AdminAPIController, :list_user_statuses)
get("/users/:nickname/chats", AdminAPIController, :list_user_chats) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) put("/users/tag", AdminAPIController, :tag_users)
delete("/users/tag", AdminAPIController, :untag_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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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/:nickname/toggle_activation", UserController, :toggle_activation)
patch("/users/activate", UserController, :activate) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) patch("/users/approve", UserController, :approve)
post("/users/invite_token", InviteController, :create) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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", ReportController, :index)
get("/reports/:id", ReportController, :show) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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", UserController, :index)
get("/users/:nickname", UserController, :show) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) put("/statuses/:id", StatusController, :update)
delete("/statuses/:id", StatusController, :delete) 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) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) post("/reload_emoji", AdminAPIController, :reload_emoji)
end end
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) delete("/instances/:instance", InstanceController, :delete)
end end
@ -403,14 +403,14 @@ defmodule Pleroma.Web.Router do
# AdminAPI: admins and mods (staff) can perform these actions (if privileged by role) # AdminAPI: admins and mods (staff) can perform these actions (if privileged by role)
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do 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) get("/stats", AdminAPIController, :stats)
end end
scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do
scope "/pack" do scope "/pack" do
pipe_through(:require_privileged_role_emoji_management) pipe_through(:require_privileged_role_emoji_manage_emoji)
post("/", EmojiPackController, :create) post("/", EmojiPackController, :create)
patch("/", EmojiPackController, :update) patch("/", EmojiPackController, :update)
@ -425,7 +425,7 @@ defmodule Pleroma.Web.Router do
# Modifying packs # Modifying packs
scope "/packs" do 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("/import", EmojiPackController, :import_from_filesystem)
get("/remote", EmojiPackController, :remote) get("/remote", EmojiPackController, :remote)

View file

@ -971,7 +971,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
describe "/api/pleroma/admin/stats" do describe "/api/pleroma/admin/stats" do
setup do setup do
clear_config([:instance, :admin_privileges], [:stats_read]) clear_config([:instance, :admin_privileges], [:statistics_read])
end end
test "status visibility count", %{conn: conn} do test "status visibility count", %{conn: conn} do
@ -1007,7 +1007,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
response["status_visibility"] response["status_visibility"]
end 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], []) clear_config([:instance, :admin_privileges], [])
assert conn assert conn

View file

@ -68,7 +68,7 @@ defmodule Pleroma.Web.AdminAPI.InstanceControllerTest do
end end
test "DELETE /instances/:instance", %{conn: conn} do 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") user = insert(:user, nickname: "lain@lain.com")
post = insert(:note_activity, user: user) post = insert(:note_activity, user: user)