Class: Api::V2::Compliance::OvalContentsController

Inherits:
BaseController
  • Object
show all
Includes:
Foreman::Controller::Parameters::OvalContent, ForemanOpenscap::Api::V2::ScapApiControllerExtensions
Defined in:
app/controllers/api/v2/compliance/oval_contents_controller.rb

Instance Method Summary collapse

Instance Method Details

#action_permissionObject



62
63
64
65
66
67
68
69
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 62

def action_permission
  case params[:action]
  when 'sync'
    :update
  else
    super
  end
end

#createObject



37
38
39
40
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 37

def create
  @oval_content = ForemanOpenscap::OvalContent.new(oval_content_params)
  process_response @oval_content.save
end

#destroyObject



53
54
55
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 53

def destroy
  process_response @oval_content.destroy
end

#indexObject



14
15
16
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 14

def index
  @oval_contents = resource_scope_for_index(:permission => :view_oval_contents)
end

#showObject



21
22
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 21

def show
end

#syncObject



58
59
60
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 58

def sync
  @oval_contents = ForemanOpenscap::Oval::SyncOvalContents.new.sync_all
end

#updateObject



46
47
48
# File 'app/controllers/api/v2/compliance/oval_contents_controller.rb', line 46

def update
  process_response @oval_content.update(oval_content_params)
end