summaryrefslogtreecommitdiff
path: root/app/controllers/agents/files_controller.rb
blob: 0f493fbc8a7cad0937bf939a5e223f0618960fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Agents
  class FilesController < ApplicationController
    before_action :load_agent
    before_action do
      request.format = :json
    end

    def index
    end

    def show
      @fingerprint = params[:id]
      @file = Disposition.find_by(fingerprint: params[:id])
      message = {
        agent_id: params[:id],
        type: :lookup,
        data: params[:data]
      }
      Publisher.publish("events.scanned.#{@agent.id}", message)
    end

    private

    def load_agent
      @agent = Agent.find(params[:agent_id])
    end
  end
end