Class: ActiveAttack::MatricesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/active_attack/matrices_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /attack/matrices POST /attack/matrices.json



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/active_attack/matrices_controller.rb', line 31

def create
  @attack_matrix = ActiveAttack::Matrix.new(attack_matrix_params)

  respond_to do |format|
    if @attack_matrix.save
      bundle = @attack_matrix.ingest_bundle(params[:attack_matrix][:uploaded_file].path)
      @attack_matrix.update(:stix_bundle_id => bundle.stix_id)
      format.html { redirect_to @attack_matrix, notice: 'Attack matrix was successfully created.' }
      format.json { render :show, status: :created, location: @attack_matrix }
    else
      format.html { render :new }
      format.json { render json: @attack_matrix.errors, status: :unprocessable_entity }
    end
  end
end

#dataObject



26
27
# File 'app/controllers/active_attack/matrices_controller.rb', line 26

def data
end

#destroyObject

DELETE /attack/matrices/1 DELETE /attack/matrices/1.json



63
64
65
66
67
68
69
# File 'app/controllers/active_attack/matrices_controller.rb', line 63

def destroy
  @attack_matrix.destroy
  respond_to do |format|
    format.html { redirect_to attack_attack_matrices_url, notice: 'Attack matrix was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /attack/matrices/1/edit



23
24
# File 'app/controllers/active_attack/matrices_controller.rb', line 23

def edit
end

#indexObject

GET /attack/matrices GET /attack/matrices.json



6
7
8
# File 'app/controllers/active_attack/matrices_controller.rb', line 6

def index
  @attack_matrices = ActiveAttack::Matrix.all
end

#newObject

GET /attack/matrices/new



18
19
20
# File 'app/controllers/active_attack/matrices_controller.rb', line 18

def new
  @attack_matrix = ActiveAttack::Matrix.new
end

#showObject

GET /attack/matrices/1 GET /attack/matrices/1.json



12
13
14
# File 'app/controllers/active_attack/matrices_controller.rb', line 12

def show
  @attack_matrix = ActiveAttack::Matrix.find(params[:id])
end

#updateObject

PATCH/PUT /stix/matrices/1 PATCH/PUT /stix/matrices/1.json



49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/active_attack/matrices_controller.rb', line 49

def update
  respond_to do |format|
    if @attack_matrix.update(attack_attack_matrix_params)
      format.html { redirect_to @attack_matrix, notice: 'Attack matrix was successfully updated.' }
      format.json { render :show, status: :ok, location: @attack_matrix }
    else
      format.html { render :edit }
      format.json { render json: @attack_matrix.errors, status: :unprocessable_entity }
    end
  end
end