Class: Bulk::ControllerActionsController Private

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/authz/bulk/controller_actions_controller.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/authz/bulk/controller_actions_controller.rb', line 7

def create
  if params[:create_all] = 'true'
    ActiveRecord::Base.transaction do
      @pending_actions = ::Authz::ControllerAction.pending
      @pending_actions.each do |controller_action_hash|
        ::Authz::ControllerAction.create!(
          controller: controller_action_hash[:controller],
          action: controller_action_hash[:action],
        )
      end
    end
    flash[:success] = "#{@pending_actions.count} actions successfully created!"
    redirect_to root_path
  else
    flash[:notice] = 'Partial bulk creation not implemented yet'
    redirect_to root_path
  end
end

#destroyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/authz/bulk/controller_actions_controller.rb', line 26

def destroy
  if params[:destroy_all] = 'true'
    ActiveRecord::Base.transaction do
      @stale_actions = ::Authz::ControllerAction.stale
      @stale_actions.each do |controller_action_hash|
        ::Authz::ControllerAction.find_by(
          controller: controller_action_hash[:controller],
          action: controller_action_hash[:action],
        ).destroy!
      end
    end
    flash[:success] = "#{@stale_actions.count} actions successfully destroyed!"
    redirect_to root_path
  else
    flash[:notice] = 'Partial bulk deletion not implemented yet'
    redirect_to root_path
  end
end