diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 1ad9367aa8e..dd99b2fda03 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,4 +1,18 @@ class Admin::GroupsController < Admin::AdminController + def index + groups = Group.order(:name).where("groups.id <> ?", Group::AUTO_GROUPS[:everyone]) + + if search = params[:search].to_s + groups = groups.where("name ILIKE ?", "%#{search}%") + end + + if params[:ignore_automatic].to_s == "true" + groups = groups.where(automatic: false) + end + + render_serialized(groups, BasicGroupSerializer) + end + def show render nothing: true end