2012-05-10 18:17:59 +01:00
|
|
|
class AdvisoriesController < ApplicationController
|
2015-03-04 23:19:19 +00:00
|
|
|
before_action :authenticate_user!
|
|
|
|
skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access']
|
2012-05-04 23:53:45 +01:00
|
|
|
|
|
|
|
def index
|
2015-06-05 21:55:55 +01:00
|
|
|
authorize :advisory
|
|
|
|
@advisories = Advisory.includes(:platforms, :projects).search(params[:q]).uniq
|
2014-06-27 12:43:31 +01:00
|
|
|
@advisories_count = @advisories.count
|
|
|
|
@advisories = @advisories.paginate(page: current_page, per_page: Advisory.per_page)
|
2012-06-20 15:07:07 +01:00
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2014-06-27 12:43:31 +01:00
|
|
|
format.json
|
2012-06-20 15:07:07 +01:00
|
|
|
format.atom
|
|
|
|
end
|
2012-05-04 23:53:45 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2015-03-17 23:06:03 +00:00
|
|
|
authorize @advisory = Advisory.find_by(advisory_id: params[:id])
|
2012-10-18 15:17:50 +01:00
|
|
|
@packages_info = @advisory.fetch_packages_info
|
2012-07-06 14:31:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def search
|
2015-06-05 21:55:55 +01:00
|
|
|
authorize :advisory
|
2012-07-06 14:31:18 +01:00
|
|
|
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
|
2013-08-08 13:16:51 +01:00
|
|
|
if @advisory.nil?
|
2014-01-21 04:51:49 +00:00
|
|
|
render nothing: true, status: 404
|
2013-08-08 13:16:51 +01:00
|
|
|
else
|
|
|
|
# respond_to do |format|
|
|
|
|
# format.json { render @advisory }
|
|
|
|
# end
|
|
|
|
render @advisory
|
2012-07-06 14:31:18 +01:00
|
|
|
end
|
|
|
|
end
|
2012-05-04 23:53:45 +01:00
|
|
|
end
|