diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19bccd115..8a18c151c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,8 +17,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object
- Experimental support for Finch. Put `config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch}` in your secrets file to use it. Reverse Proxy will still use Hackney.
- `ForceMentionsInPostContent` MRF policy
-- AdminAPI: allow moderators to manage reports, users, invites, and custom emojis
-- AdminAPI: restrict moderators to access sensitive data: change user credentials, get password reset token, read private statuses and chats, etc
- PleromaAPI: Add remote follow API endpoint at `POST /api/v1/pleroma/remote_interaction`
- MastoAPI: Add `GET /api/v1/accounts/lookup`
- MastoAPI: Profile Directory support
diff --git a/config/config.exs b/config/config.exs
index 2a5770bf4..4cdc90c7a 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -256,8 +256,7 @@ config :pleroma, :instance,
show_reactions: true,
password_reset_token_validity: 60 * 60 * 24,
profile_directory: true,
- privileged_staff: false,
- admin_privileges: [:user_deletion, :user_credentials],
+ admin_privileges: [:user_deletion, :user_credentials, :statuses_read],
moderator_privileges: [],
max_endorsed_users: 20,
birthday_required: false,
diff --git a/config/description.exs b/config/description.exs
index 4986ccce6..b0b8ecd88 100644
--- a/config/description.exs
+++ b/config/description.exs
@@ -960,23 +960,17 @@ config :pleroma, :config_description, [
type: :boolean,
description: "Enable profile directory."
},
- %{
- key: :privileged_staff,
- type: :boolean,
- description:
- "Let moderators access sensitive data (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
- },
%{
key: :admin_privileges,
type: {:list, :atom},
- suggestions: [:user_deletion, :user_credentials],
+ suggestions: [:user_deletion, :user_credentials, :statuses_read],
description:
"What extra priviledges to allow admins (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
},
%{
key: :moderator_privileges,
type: {:list, :atom},
- suggestions: [:user_deletion, :user_credentials],
+ suggestions: [:user_deletion, :user_credentials, :statuses_read],
description:
"What extra priviledges to allow moderators (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
},
diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex
index ee52475d5..f89c95a1c 100644
--- a/lib/pleroma/web/mastodon_api/views/instance_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex
@@ -47,7 +47,6 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
federation: federation(),
fields_limits: fields_limits(),
post_formats: Config.get([:instance, :allowed_post_formats]),
- privileged_staff: Config.get([:instance, :privileged_staff]),
birthday_required: Config.get([:instance, :birthday_required]),
birthday_min_age: Config.get([:instance, :birthday_min_age])
},
diff --git a/lib/pleroma/web/nodeinfo/nodeinfo.ex b/lib/pleroma/web/nodeinfo/nodeinfo.ex
index 62d445f34..c7b9ab2de 100644
--- a/lib/pleroma/web/nodeinfo/nodeinfo.ex
+++ b/lib/pleroma/web/nodeinfo/nodeinfo.ex
@@ -69,8 +69,7 @@ defmodule Pleroma.Web.Nodeinfo.Nodeinfo do
mailerEnabled: Config.get([Pleroma.Emails.Mailer, :enabled], false),
features: features,
restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]),
- skipThreadContainment: Config.get([:instance, :skip_thread_containment], false),
- privilegedStaff: Config.get([:instance, :privileged_staff])
+ skipThreadContainment: Config.get([:instance, :skip_thread_containment], false)
}
}
end
diff --git a/lib/pleroma/web/plugs/ensure_staff_privileged_plug.ex b/lib/pleroma/web/plugs/ensure_staff_privileged_plug.ex
deleted file mode 100644
index 3c2109496..000000000
--- a/lib/pleroma/web/plugs/ensure_staff_privileged_plug.ex
+++ /dev/null
@@ -1,36 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2022 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.Plugs.EnsureStaffPrivilegedPlug do
- @moduledoc """
- Ensures staff are privileged enough to do certain tasks.
- """
- import Pleroma.Web.TranslationHelpers
- import Plug.Conn
-
- alias Pleroma.Config
- alias Pleroma.User
-
- def init(options) do
- options
- end
-
- def call(%{assigns: %{user: %User{is_admin: true}}} = conn, _), do: conn
-
- def call(%{assigns: %{user: %User{is_moderator: true}}} = conn, _) do
- if Config.get!([:instance, :privileged_staff]) do
- conn
- else
- conn
- |> render_error(:forbidden, "User is not an admin.")
- |> halt()
- end
- end
-
- def call(conn, _) do
- conn
- |> render_error(:forbidden, "User is not a staff member.")
- |> halt()
- end
-end
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index 4696b4007..21b77b624 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -101,10 +101,6 @@ defmodule Pleroma.Web.Router do
plug(Pleroma.Web.Plugs.IdempotencyPlug)
end
- pipeline :require_privileged_staff do
- plug(Pleroma.Web.Plugs.EnsureStaffPrivilegedPlug)
- end
-
pipeline :require_admin do
plug(Pleroma.Web.Plugs.UserIsAdminPlug)
end
@@ -273,11 +269,6 @@ defmodule Pleroma.Web.Router do
get("/chats/:id/messages", ChatController, :messages)
end
- # AdminAPI: admins and mods (staff) can perform these actions (if enabled by config)
- scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
- pipe_through([:admin_api, :require_privileged_staff])
- end
-
# AdminAPI: admins and mods (staff) can perform these actions
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
pipe_through(:admin_api)
diff --git a/test/pleroma/web/plugs/ensure_staff_privileged_plug_test.exs b/test/pleroma/web/plugs/ensure_staff_privileged_plug_test.exs
deleted file mode 100644
index c684714b8..000000000
--- a/test/pleroma/web/plugs/ensure_staff_privileged_plug_test.exs
+++ /dev/null
@@ -1,60 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2022 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.Plugs.EnsureStaffPrivilegedPlugTest do
- use Pleroma.Web.ConnCase, async: true
-
- alias Pleroma.Web.Plugs.EnsureStaffPrivilegedPlug
- import Pleroma.Factory
-
- test "accepts a user that is an admin" do
- user = insert(:user, is_admin: true)
-
- conn = assign(build_conn(), :user, user)
-
- ret_conn = EnsureStaffPrivilegedPlug.call(conn, %{})
-
- assert conn == ret_conn
- end
-
- test "accepts a user that is a moderator when :privileged_staff is enabled" do
- clear_config([:instance, :privileged_staff], true)
- user = insert(:user, is_moderator: true)
-
- conn = assign(build_conn(), :user, user)
-
- ret_conn = EnsureStaffPrivilegedPlug.call(conn, %{})
-
- assert conn == ret_conn
- end
-
- test "denies a user that is a moderator when :privileged_staff is disabled" do
- clear_config([:instance, :privileged_staff], false)
- user = insert(:user, is_moderator: true)
-
- conn =
- build_conn()
- |> assign(:user, user)
- |> EnsureStaffPrivilegedPlug.call(%{})
-
- assert conn.status == 403
- end
-
- test "denies a user that isn't a staff member" do
- user = insert(:user)
-
- conn =
- build_conn()
- |> assign(:user, user)
- |> EnsureStaffPrivilegedPlug.call(%{})
-
- assert conn.status == 403
- end
-
- test "denies when a user isn't set" do
- conn = EnsureStaffPrivilegedPlug.call(build_conn(), %{})
-
- assert conn.status == 403
- end
-end