Require admin access for webhooks
This commit is contained in:
parent
9061851fed
commit
27090ad7e6
2 changed files with 23 additions and 10 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.AdminAPI.WebhookControllerTest do
|
||||
use Pleroma.Web.ConnCase, async: true
|
||||
use Pleroma.Web.ConnCase, async: false
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
|
|
@ -33,6 +33,19 @@ defmodule Pleroma.Web.AdminAPI.WebhookControllerTest do
|
|||
|
||||
assert length(response) == 2
|
||||
end
|
||||
|
||||
test "requires an admin even if a moderator can manage announcements" do
|
||||
clear_config([:instance, :moderator_privileges], [:announcements_manage_announcements])
|
||||
|
||||
moderator = insert(:user, is_moderator: true)
|
||||
token = insert(:oauth_admin_token, user: moderator)
|
||||
|
||||
build_conn()
|
||||
|> assign(:user, moderator)
|
||||
|> assign(:token, token)
|
||||
|> get("/api/pleroma/admin/webhooks")
|
||||
|> json_response(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /api/pleroma/admin/webhooks" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue