X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fcontrollers%2Ffilter_controller.ex;h=7fd0562c98ceeee9838658063a73ecd66bddbf90;hb=908cf22a6cb07044eb0fb44c9673c8adcf22c0db;hp=19041304eea7a58b7b0d896abab425ec95a4e772;hpb=26f66fb70ab1bd777a92daf4347aaa63b044d0af;p=akkoma
diff --git a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex
index 19041304e..7fd0562c9 100644
--- a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex
@@ -1,11 +1,21 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.FilterController do
use Pleroma.Web, :controller
alias Pleroma.Filter
+ alias Pleroma.Plugs.OAuthScopesPlug
+
+ @oauth_read_actions [:show, :index]
+
+ plug(OAuthScopesPlug, %{scopes: ["read:filters"]} when action in @oauth_read_actions)
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write:filters"]} when action not in @oauth_read_actions
+ )
@doc "GET /api/v1/filters"
def index(%{assigns: %{user: user}} = conn, _) do