about summary refs log tree commit diff
path: root/app/controllers/api/v2
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-03-30 15:02:16 +0200
committerGitHub <noreply@github.com>2022-03-30 15:02:16 +0200
commit60f9973f452100475874cd9bd0a8b6ee908bf8e0 (patch)
treed1bb823de4bff3ee9676835dc3e7614ed66deb65 /app/controllers/api/v2
parenteaea849035ea407afb2d5db411dbddc1ccca6f44 (diff)
parent51a297e1287a9b2dd3b2d2b19433820e996779db (diff)
Merge pull request #1725 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api/v2')
-rw-r--r--app/controllers/api/v2/admin/accounts_controller.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/controllers/api/v2/admin/accounts_controller.rb b/app/controllers/api/v2/admin/accounts_controller.rb
new file mode 100644
index 000000000..a89e6835e
--- /dev/null
+++ b/app/controllers/api/v2/admin/accounts_controller.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class Api::V2::Admin::AccountsController < Api::V1::Admin::AccountsController
+  FILTER_PARAMS = %i(
+    origin
+    status
+    permissions
+    username
+    by_domain
+    display_name
+    email
+    ip
+    invited_by
+  ).freeze
+
+  PAGINATION_PARAMS = (%i(limit) + FILTER_PARAMS).freeze
+
+  private
+
+  def filtered_accounts
+    AccountFilter.new(filter_params).results
+  end
+
+  def filter_params
+    params.permit(*FILTER_PARAMS)
+  end
+
+  def pagination_params(core_params)
+    params.slice(*PAGINATION_PARAMS).permit(*PAGINATION_PARAMS).merge(core_params)
+  end
+end