Sha256: db7ee22d706eb351601900dcc6fe9e67daf30c33fbe0ca6ec0ff5fdd81dc8bfc
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require_dependency "authz/application_controller" module Authz # @api private class Bulk::ControllerActionsController < ApplicationController 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 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems