+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["read:accounts"]}
+ when action in [:list_users, :user_show, :right_get, :invites]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write:accounts"]}
+ when action in [
+ :get_invite_token,
+ :revoke_invite,
+ :email_invite,
+ :get_password_reset,
+ :user_follow,
+ :user_unfollow,
+ :user_delete,
+ :users_create,
+ :user_toggle_activation,
+ :user_activate,
+ :user_deactivate,
+ :tag_users,
+ :untag_users,
+ :right_add,
+ :right_delete
+ ]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["read:reports"]} when action in [:list_reports, :report_show]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write:reports"]}
+ when action in [:report_update_state, :report_respond]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["read:statuses"]} when action == :list_user_statuses
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write:statuses"]}
+ when action in [:status_update, :status_delete]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["read"]}
+ when action in [:config_show, :migrate_to_db, :migrate_from_db, :list_log]
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["write"]}
+ when action in [:relay_follow, :relay_unfollow, :config_update]
+ )
+