Class: Api::V2::Compliance::OvalPoliciesController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::Compliance::OvalPoliciesController
- Includes:
- Foreman::Controller::Parameters::OvalPolicy, Foreman::Controller::SmartProxyAuth, ForemanOpenscap::Api::V2::ScapApiControllerExtensions
- Defined in:
- app/controllers/api/v2/compliance/oval_policies_controller.rb
Instance Method Summary collapse
- #action_permission ⇒ Object
- #assign_hostgroups ⇒ Object
- #assign_hosts ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #oval_content ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#action_permission ⇒ Object
88 89 90 91 92 93 94 95 96 97 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 88 def case params[:action] when 'assign_hostgroups', 'assign_hosts' :edit when 'oval_content' :show else super end end |
#assign_hostgroups ⇒ Object
66 67 68 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 66 def assign_hostgroups assign _('hostgroups'), params["hostgroup_ids"], ::Hostgroup end |
#assign_hosts ⇒ Object
74 75 76 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 74 def assign_hosts assign _('hosts'), params["host_ids"], ::Host::Managed end |
#create ⇒ Object
42 43 44 45 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 42 def create @oval_policy = ForemanOpenscap::OvalPolicy.new(oval_policy_params) process_response(@oval_policy.save) end |
#destroy ⇒ Object
58 59 60 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 58 def destroy process_response @oval_policy.destroy end |
#index ⇒ Object
16 17 18 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 16 def index @oval_policies = resource_scope_for_index(:permission => :view_oval_policies) end |
#oval_content ⇒ Object
81 82 83 84 85 86 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 81 def oval_content @oval_content = @oval_policy.oval_content send_data @oval_content.scap_file, :type => 'application/x-bzip2', :filename => @oval_content.original_filename end |
#show ⇒ Object
23 24 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 23 def show end |
#update ⇒ Object
51 52 53 |
# File 'app/controllers/api/v2/compliance/oval_policies_controller.rb', line 51 def update process_response(@oval_policy.update(oval_policy_params)) end |