Class: ActiveAttack::PlaybooksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ActiveAttack::PlaybooksController
- Defined in:
- app/controllers/active_attack/playbooks_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /attack/playbooks POST /attack/playbooks.json.
-
#destroy ⇒ Object
DELETE /attack/playbooks/1 DELETE /attack/playbooks/1.json.
-
#edit ⇒ Object
GET /attack/playbooks/1/edit.
-
#index ⇒ Object
GET /attack/playbooks GET /attack/playbooks.json.
-
#new ⇒ Object
GET /attack/playbooks/new.
-
#show ⇒ Object
GET /attack/playbooks/1 GET /attack/playbooks/1.json.
-
#update ⇒ Object
PATCH/PUT /attack/playbooks/1 PATCH/PUT /attack/playbooks/1.json.
Instance Method Details
#create ⇒ Object
POST /attack/playbooks POST /attack/playbooks.json
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 38 def create @attack_playbook = ActiveAttack::Playbook.new(attack_playbook_params) respond_to do |format| if @attack_playbook.save bundle = @attack_playbook.ingest_bundle(params[:attack_playbook][:uploaded_file].path) @attack_playbook.update(:stix_bundle_id => bundle.stix_id) format.html { redirect_to @attack_playbook, notice: 'Playbook was successfully created.' } format.json { render :show, status: :created, location: @attack_playbook } else format.html { render :new } format.json { render json: @attack_playbook.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /attack/playbooks/1 DELETE /attack/playbooks/1.json
70 71 72 73 74 75 76 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 70 def destroy @attack_playbook.destroy respond_to do |format| format.html { redirect_to attack_playbooks_url, notice: 'Playbook was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /attack/playbooks/1/edit
33 34 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 33 def edit end |
#index ⇒ Object
GET /attack/playbooks GET /attack/playbooks.json
6 7 8 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 6 def index @playbooks = ActiveAttack::Playbook.all end |
#new ⇒ Object
GET /attack/playbooks/new
28 29 30 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 28 def new @attack_playbook = ActiveAttack::Playbook.new end |
#show ⇒ Object
GET /attack/playbooks/1 GET /attack/playbooks/1.json
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 12 def show # @attack_playbook.stix_bundle.bundled_objects.each do | x | # render :json => @attack_playbook.stix_bundle # end @playbooks = ActiveAttack::Playbook.all @playbook = @playbooks.find(params[:id]) @threat_actor = @playbook.threat_actor @report = @playbook.bundle respond_to do |format| format.html format.json {render json: @playbook.as_stix} end end |
#update ⇒ Object
PATCH/PUT /attack/playbooks/1 PATCH/PUT /attack/playbooks/1.json
56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/active_attack/playbooks_controller.rb', line 56 def update respond_to do |format| if @attack_playbook.update(attack_playbook_params) format.html { redirect_to @attack_playbook, notice: 'Playbook was successfully updated.' } format.json { render :show, status: :ok, location: @attack_playbook } else format.html { render :edit } format.json { render json: @attack_playbook.errors, status: :unprocessable_entity } end end end |