Sha256: 250bfab4f9692047e0bdf3c94ea838f8f4acd1b95bd7f8f7f39852b36a9937b2

Contents?: true

Size: 926 Bytes

Versions: 4

Compression:

Stored size: 926 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Controller that lists users in order to perform impersonation actions on
    # them
    #
    class ImpersonatableUsersController < Decidim::Admin::ApplicationController
      layout "decidim/admin/users"

      helper_method :new_managed_user

      def index
        enforce_permission_to :index, :impersonatable_user

        @query = params[:q]
        @state = params[:state]

        @users = Decidim::Admin::UserFilter.for(collection, @query, @state)
                                           .page(params[:page])
                                           .per(15)
      end

      private

      def collection
        @collection ||= current_organization.users.not_deleted.not_blocked.where(admin: false, roles: [])
      end

      def new_managed_user
        Decidim::User.new(managed: true, admin: false, roles: [])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/controllers/decidim/admin/impersonatable_users_controller.rb
decidim-admin-0.27.8 app/controllers/decidim/admin/impersonatable_users_controller.rb
decidim-admin-0.27.7 app/controllers/decidim/admin/impersonatable_users_controller.rb
decidim-admin-0.27.6 app/controllers/decidim/admin/impersonatable_users_controller.rb