Remove :auth, :enforce_oauth_admin_scope_usage

`admin` scope has been required by default for more than a year now
and all apps that use the API seems to request a proper scope by now.
This commit is contained in:
rinpatch 2021-02-17 20:47:38 +03:00
commit 6d66fadea7
9 changed files with 70 additions and 239 deletions

View file

@ -100,15 +100,7 @@ defmodule Pleroma.Config do
def oauth_consumer_enabled?, do: oauth_consumer_strategies() != []
def enforce_oauth_admin_scope_usage?, do: !!get([:auth, :enforce_oauth_admin_scope_usage])
def oauth_admin_scopes(scopes) when is_list(scopes) do
Enum.flat_map(
scopes,
fn scope ->
["admin:#{scope}"] ++
if enforce_oauth_admin_scope_usage?(), do: [], else: [scope]
end
)
Enum.map(scopes, fn scope -> "admin:#{scope}" end)
end
end