Browse Source

[#1478] Adjusted AdminAPIController admin subscope requirements.

revert/attachment-cleanup
Ivan Tashkinov 4 years ago
parent
commit
76c1948880
1 changed files with 16 additions and 7 deletions
  1. +16
    -7
      lib/pleroma/web/admin_api/admin_api_controller.ex

+ 16
- 7
lib/pleroma/web/admin_api/admin_api_controller.ex View File

@@ -32,19 +32,14 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
plug( plug(
OAuthScopesPlug, OAuthScopesPlug,
%{scopes: ["read:accounts"], admin: true} %{scopes: ["read:accounts"], admin: true}
when action in [:list_users, :user_show, :right_get, :invites]
when action in [:list_users, :user_show, :right_get]
) )


plug( plug(
OAuthScopesPlug, OAuthScopesPlug,
%{scopes: ["write:accounts"], admin: true} %{scopes: ["write:accounts"], admin: true}
when action in [ when action in [
:get_invite_token,
:revoke_invite,
:email_invite,
:get_password_reset, :get_password_reset,
:user_follow,
:user_unfollow,
:user_delete, :user_delete,
:users_create, :users_create,
:user_toggle_activation, :user_toggle_activation,
@@ -57,6 +52,20 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
] ]
) )


plug(OAuthScopesPlug, %{scopes: ["read:invites"], admin: true} when action == :invites)

plug(
OAuthScopesPlug,
%{scopes: ["write:invites"], admin: true}
when action in [:create_invite_token, :revoke_invite, :email_invite]
)

plug(
OAuthScopesPlug,
%{scopes: ["write:follows"], admin: true}
when action in [:user_follow, :user_unfollow, :relay_follow, :relay_unfollow]
)

plug( plug(
OAuthScopesPlug, OAuthScopesPlug,
%{scopes: ["read:reports"], admin: true} %{scopes: ["read:reports"], admin: true}
@@ -90,7 +99,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
plug( plug(
OAuthScopesPlug, OAuthScopesPlug,
%{scopes: ["write"], admin: true} %{scopes: ["write"], admin: true}
when action in [:relay_follow, :relay_unfollow, :config_update]
when action == :config_update
) )


@users_page_size 50 @users_page_size 50


Loading…
Cancel
Save