foreman_openscap 1.0.10 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +11 -3
  3. data/app/controllers/api/v2/compliance/policies_controller.rb +2 -9
  4. data/app/controllers/api/v2/compliance/scap_content_profiles_controller.rb +15 -0
  5. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +2 -8
  6. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +2 -8
  7. data/app/controllers/concerns/foreman_openscap/api/v2/scap_api_controller_extensions.rb +9 -0
  8. data/app/controllers/policies_controller.rb +1 -1
  9. data/app/helpers/compliance_hosts_helper.rb +23 -0
  10. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +0 -6
  11. data/app/models/concerns/foreman_openscap/host_extensions.rb +1 -1
  12. data/app/models/concerns/foreman_openscap/smart_proxy_extensions.rb +1 -1
  13. data/app/models/foreman_openscap/policy.rb +12 -0
  14. data/app/models/foreman_openscap/scap_content_profile.rb +3 -0
  15. data/app/services/foreman_openscap/lookup_key_overrider.rb +3 -2
  16. data/app/views/api/v2/compliance/scap_content_profiles/base.json.rabl +3 -0
  17. data/app/views/api/v2/compliance/scap_content_profiles/index.json.rabl +3 -0
  18. data/app/views/api/v2/compliance/scap_content_profiles/main.json.rabl +9 -0
  19. data/app/views/arf_reports/_list.html.erb +1 -1
  20. data/app/views/arf_reports/welcome.html.erb +2 -0
  21. data/app/views/hosts/select_multiple_openscap_proxy.html.erb +1 -1
  22. data/app/views/policies/disassociate_multiple_hosts.html.erb +1 -1
  23. data/app/views/policies/select_multiple_hosts.html.erb +1 -1
  24. data/config/routes.rb +2 -0
  25. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +0 -2
  26. data/db/migrate/20200117135424_migrate_port_overrides_to_int.rb +24 -0
  27. data/lib/foreman_openscap/engine.rb +15 -10
  28. data/lib/foreman_openscap/helper.rb +1 -1
  29. data/lib/foreman_openscap/version.rb +1 -1
  30. data/locale/action_names.rb +1 -1
  31. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  32. data/locale/de/foreman_openscap.po +244 -241
  33. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  34. data/locale/en_GB/foreman_openscap.po +38 -38
  35. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  36. data/locale/es/foreman_openscap.po +285 -283
  37. data/locale/foreman_openscap.pot +119 -120
  38. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  39. data/locale/fr/foreman_openscap.po +292 -284
  40. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  41. data/locale/gl/foreman_openscap.po +49 -49
  42. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  43. data/locale/it/foreman_openscap.po +74 -73
  44. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  45. data/locale/ja/foreman_openscap.po +284 -282
  46. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  47. data/locale/ko/foreman_openscap.po +155 -155
  48. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  49. data/locale/pt_BR/foreman_openscap.po +287 -280
  50. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  51. data/locale/ru/foreman_openscap.po +163 -160
  52. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  53. data/locale/sv_SE/foreman_openscap.po +49 -49
  54. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  55. data/locale/zh_CN/foreman_openscap.po +284 -281
  56. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  57. data/locale/zh_TW/foreman_openscap.po +151 -150
  58. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +0 -3
  59. data/test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb +15 -0
  60. data/test/test_plugin_helper.rb +2 -2
  61. data/test/unit/concerns/host_extensions_test.rb +7 -0
  62. data/test/unit/policy_test.rb +19 -0
  63. metadata +24 -32
  64. data/app/overrides/hosts/overview/host_compliance_status.rb +0 -4
  65. data/app/views/compliance_hosts/_compliance_status.erb +0 -6
  66. data/locale/de/foreman_openscap.edit.po +0 -0
  67. data/locale/en_GB/foreman_openscap.edit.po +0 -0
  68. data/locale/es/foreman_openscap.edit.po +0 -0
  69. data/locale/fr/foreman_openscap.edit.po +0 -0
  70. data/locale/gl/foreman_openscap.edit.po +0 -0
  71. data/locale/it/foreman_openscap.edit.po +0 -0
  72. data/locale/ja/foreman_openscap.edit.po +0 -0
  73. data/locale/ko/foreman_openscap.edit.po +0 -0
  74. data/locale/pt_BR/foreman_openscap.edit.po +0 -0
  75. data/locale/ru/foreman_openscap.edit.po +0 -0
  76. data/locale/sv_SE/foreman_openscap.edit.po +0 -0
  77. data/locale/zh_CN/foreman_openscap.edit.po +0 -0
  78. data/locale/zh_TW/foreman_openscap.edit.po +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 87ddf6db13920646845c140e0407a5dbb273b1a9
4
- data.tar.gz: c3548218d58677c3cf5851ed068458819284ad1d
2
+ SHA256:
3
+ metadata.gz: c9022cadb1e56bd7bf36523d096543e50bcadb360327e0f930d00a8308774203
4
+ data.tar.gz: a1cf2ae2a6bfd3dd77de305ea65312e07ca51ec61ceed96c625e48a170306183
5
5
  SHA512:
6
- metadata.gz: e24471d79d5e07ba29882f1e82494d1592ae903b6c2aaab8f5232a5ff9bc9a15da4206268c8c40333162e0e2d7838539917bca0bf6518cf4d03cc0f3ac057013
7
- data.tar.gz: e979eacc2fc7f2c9ccc8fc201b8df0468f2ba0a49c9c6d8a492bab62829ade22a0110655771f2413b9901192688b90b73bacee3896052965271b8bb35f2f3b9c
6
+ metadata.gz: 43d354207d9200b8d230312cd6259ff76b27ee75a87bcace113df7b323fad7bc4be4012ea15fd1aa1134fc91e9fff6aa93a2e07deeef2acd4f358e4cd031b63c
7
+ data.tar.gz: fda20c152e9bf85fc7a42d85e1d8472386ea8b1fa9fc516373f144019c39cd797db4b49f60312165b154e4c59f63cf948ae7cb364990c020687a28020434b12c
@@ -90,12 +90,14 @@ module Api
90
90
  end
91
91
 
92
92
  def find_resources_before_create
93
- unless ForemanOpenscap::Policy.where(:id => params[:policy_id]).any?
94
- upload_fail(_("Policy with id %s not found.") % params[:policy_id])
93
+ policy_id = params[:policy_id].to_i
94
+
95
+ unless ForemanOpenscap::Policy.where(:id => policy_id).any?
96
+ upload_fail(_("Policy with id %s not found.") % policy_id)
95
97
  return
96
98
  end
97
99
 
98
- @asset = ForemanOpenscap::Helper::get_asset(params[:cname], params[:policy_id])
100
+ @asset = ForemanOpenscap::Helper::get_asset(params[:cname], policy_id)
99
101
 
100
102
  unless @asset
101
103
  upload_fail(_('Could not find host identified by: %s') % params[:cname])
@@ -138,6 +140,12 @@ module Api
138
140
  super
139
141
  end
140
142
  end
143
+
144
+ protected
145
+
146
+ def assign_lone_taxonomies
147
+ # do not assign lone taxonomies to arf report
148
+ end
141
149
  end
142
150
  end
143
151
  end
@@ -3,6 +3,7 @@ module Api::V2
3
3
  class PoliciesController < ::Api::V2::BaseController
4
4
  include Foreman::Controller::SmartProxyAuth
5
5
  include Foreman::Controller::Parameters::PolicyApi
6
+ include ForemanOpenscap::Api::V2::ScapApiControllerExtensions
6
7
 
7
8
  add_smart_proxy_filters %i[content tailoring], :features => 'Openscap'
8
9
 
@@ -10,14 +11,6 @@ module Api::V2
10
11
 
11
12
  skip_after_action :log_response_body, :only => [:content]
12
13
 
13
- def resource_name(resource = '::ForemanOpenscap::Policy')
14
- super resource
15
- end
16
-
17
- def get_resource(message = 'no resource loaded')
18
- instance_variable_get(:"@policy") || raise(message)
19
- end
20
-
21
14
  def policy_url(policy = nil)
22
15
  api_compliance_policy_url(@policy)
23
16
  end
@@ -69,7 +62,7 @@ module Api::V2
69
62
  param_group :policy
70
63
 
71
64
  def update
72
- process_response @policy.update_attributes(policy_params)
65
+ process_response(@policy.change_deploy_type(policy_params))
73
66
  end
74
67
 
75
68
  api :DELETE, '/compliance/policies/:id', N_('Delete a Policy')
@@ -0,0 +1,15 @@
1
+ module Api::V2
2
+ module Compliance
3
+ class ScapContentProfilesController < ::Api::V2::BaseController
4
+ include ForemanOpenscap::Api::V2::ScapApiControllerExtensions
5
+
6
+ api :GET, '/compliance/scap_content_profiles', N_('List SCAP content profiles')
7
+ param_group :search_and_pagination, ::Api::V2::BaseController
8
+ add_scoped_search_description_for(::ForemanOpenscap::ScapContentProfile)
9
+
10
+ def index
11
+ @scap_content_profiles = resource_scope_for_index(:permission => :view_scap_contents).includes(:scap_content, :tailoring_file)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,15 +3,9 @@ module Api::V2
3
3
  class ScapContentsController < ::Api::V2::BaseController
4
4
  include Foreman::Controller::Parameters::ScapContent
5
5
  include ForemanOpenscap::BodyLogExtensions
6
- before_action :find_resource, :except => %w[index create]
7
-
8
- def resource_name(resource = '::ForemanOpenscap::ScapContent')
9
- super resource
10
- end
6
+ include ForemanOpenscap::Api::V2::ScapApiControllerExtensions
11
7
 
12
- def get_resource(message = 'no resource loaded')
13
- instance_variable_get(:"@scap_content") || raise(message)
14
- end
8
+ before_action :find_resource, :except => %w[index create]
15
9
 
16
10
  api :GET, '/compliance/scap_contents', N_('List SCAP contents')
17
11
  param_group :search_and_pagination, ::Api::V2::BaseController
@@ -3,17 +3,11 @@ module Api::V2
3
3
  class TailoringFilesController < ::Api::V2::BaseController
4
4
  include Foreman::Controller::Parameters::TailoringFile
5
5
  include ForemanOpenscap::BodyLogExtensions
6
+ include ForemanOpenscap::Api::V2::ScapApiControllerExtensions
7
+
6
8
  before_action :find_resource, :except => %w[index create]
7
9
  before_action :openscap_proxy_check, :only => %w[create]
8
10
 
9
- def resource_name(resource = '::ForemanOpenscap::TailoringFile')
10
- super resource
11
- end
12
-
13
- def get_resource(message = 'no resource loaded')
14
- instance_variable_get(:"@tailoring_file") || raise(message)
15
- end
16
-
17
11
  api :GET, '/compliance/tailoring_files', N_('List Tailoring files')
18
12
  param_group :search_and_pagination, ::Api::V2::BaseController
19
13
  add_scoped_search_description_for(::ForemanOpenscap::TailoringFile)
@@ -0,0 +1,9 @@
1
+ module ForemanOpenscap
2
+ module Api::V2::ScapApiControllerExtensions
3
+ extend ActiveSupport::Concern
4
+
5
+ def resource_class_for(resource)
6
+ super "foreman_openscap/#{resource}"
7
+ end
8
+ end
9
+ end
@@ -46,7 +46,7 @@ class PoliciesController < ApplicationController
46
46
  end
47
47
 
48
48
  def update
49
- if @policy.update_attributes(policy_params)
49
+ if @policy.change_deploy_type(policy_params)
50
50
  process_success :success_redirect => policies_path
51
51
  else
52
52
  process_error :object => @policy
@@ -18,4 +18,27 @@ module ComplianceHostsHelper
18
18
  ]
19
19
  { :data => data, :xAxisDataLabel => 'dates', :config => 'timeseries' }.to_json
20
20
  end
21
+
22
+ def compliance_host_multiple_actions
23
+ [
24
+ { :action => [_('Assign Compliance Policy'), select_multiple_hosts_policies_path], :priority => 1210 },
25
+ { :action => [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path], :priority => 1211 },
26
+ { :action => [_('Change OpenSCAP Proxy'), select_multiple_openscap_proxy_hosts_path], :priority => 1212 },
27
+ ]
28
+ end
29
+
30
+ def compliance_host_overview_button(host)
31
+ return [] if host.arf_reports.none?
32
+ [
33
+ {
34
+ :button => link_to_if_authorized(
35
+ _('Compliance'),
36
+ hash_for_compliance_host_path(host.id),
37
+ :title => _("Host compliance details"),
38
+ :class => 'btn btn-default'
39
+ ),
40
+ :priority => 1000
41
+ }
42
+ ]
43
+ end
21
44
  end
@@ -1,11 +1,5 @@
1
1
  module ForemanOpenscap
2
2
  module HostsHelperExtensions
3
- def multiple_actions
4
- super + [[_('Assign Compliance Policy'), select_multiple_hosts_policies_path],
5
- [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path],
6
- [_('Change OpenSCAP Proxy'), select_multiple_openscap_proxy_hosts_path]]
7
- end
8
-
9
3
  def name_column(record)
10
4
  record.nil? ? _('Host is deleted') : super(record)
11
5
  end
@@ -3,7 +3,7 @@ module ForemanOpenscap
3
3
  ::Host::Managed::Jail.allow :policies_enc, :policies_enc_raw
4
4
 
5
5
  def self.prepended(base)
6
- base.has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset"
6
+ base.has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", :dependent => :destroy
7
7
  base.has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
8
8
  base.has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
9
9
  base.has_many :arf_reports, :class_name => '::ForemanOpenscap::ArfReport', :foreign_key => :host_id
@@ -11,7 +11,7 @@ module ForemanOpenscap
11
11
  end
12
12
 
13
13
  def port
14
- url.match(PORT_MATCH)[1]
14
+ url.match(PORT_MATCH)[1].to_i
15
15
  end
16
16
 
17
17
  private
@@ -60,6 +60,17 @@ module ForemanOpenscap
60
60
  api.policy_html_guide(scap_content.scap_file, scap_content_profile.try(:profile_id))
61
61
  end
62
62
 
63
+ def change_deploy_type(params)
64
+ self.class.transaction do
65
+ if deploy_by != params[:deploy_by]
66
+ assign_attributes params
67
+ ForemanOpenscap::LookupKeyOverrider.new(self).override
68
+ end
69
+
70
+ errors.none? && update_attributes(params)
71
+ end
72
+ end
73
+
63
74
  def hostgroup_ids
64
75
  assets.where(:assetable_type => 'Hostgroup').pluck(:assetable_id)
65
76
  end
@@ -312,6 +323,7 @@ module ForemanOpenscap
312
323
  def no_mixed_deployments
313
324
  assets.each do |asset|
314
325
  assetable = asset.assetable
326
+ next unless assetable
315
327
  unless assetable.policies.where.not(:id => id).pluck(:deploy_by).all? { |deployed_by| deployed_by == deploy_by }
316
328
  errors.add(:base, _("cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy") % assetable.name)
317
329
  end
@@ -4,5 +4,8 @@ module ForemanOpenscap
4
4
  has_many :policies
5
5
  belongs_to :tailoring_file
6
6
  has_many :tailoring_file_policies, :class_name => 'ForemanOpenscap::Policy'
7
+
8
+ scoped_search :on => :profile_id, :complete_value => true
9
+ scoped_search :on => :title, :complete_value => true
7
10
  end
8
11
  end
@@ -71,16 +71,17 @@ module ForemanOpenscap
71
71
  end
72
72
 
73
73
  def override_port_param(param, config)
74
- override_param config.port_param, param, config
74
+ override_param config.port_param, param, config, 'integer'
75
75
  end
76
76
 
77
77
  def override_server_param(param, config)
78
78
  override_param config.server_param, param, config
79
79
  end
80
80
 
81
- def override_param(param_name, param, config)
81
+ def override_param(param_name, param, config, key_type = nil)
82
82
  param.override = true
83
83
  param.hidden_value = false
84
+ param.key_type = key_type if key_type
84
85
 
85
86
  yield param if block_given?
86
87
 
@@ -0,0 +1,3 @@
1
+ object @scap_content_profile
2
+
3
+ attributes :id, :profile_id, :title
@@ -0,0 +1,3 @@
1
+ collection @scap_content_profiles
2
+
3
+ extends "api/v2/compliance/scap_content_profiles/main"
@@ -0,0 +1,9 @@
1
+ extends "api/v2/compliance/scap_content_profiles/base"
2
+
3
+ child :scap_content => :scap_content do |scap_content|
4
+ attributes :id, :title
5
+ end
6
+
7
+ child :tailoring_file => :tailoring_file do |tailoring_file|
8
+ attributes :id, :name
9
+ end
@@ -51,7 +51,7 @@
51
51
  </div>
52
52
  <div class="modal-footer">
53
53
  <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
54
- <button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
54
+ <button type="button" class="btn btn-primary" onclick="tfm.hosts.table.submitModalForm()"><%= _('Submit') %></button>
55
55
  </div>
56
56
  </div>
57
57
  </div>
@@ -1,3 +1,5 @@
1
+ <% title _("Compliance Reports") %>
2
+
1
3
  <div class="blank-slate-pf">
2
4
  <div class="blank-slate-pf-icon">
3
5
  <%= icon_text("book", "", :kind => "fa") %>
@@ -4,5 +4,5 @@
4
4
  :url => update_multiple_openscap_proxy_hosts_path(:host_ids => params[:host_ids]) do |f| %>
5
5
  <%= selectable_f f, :id, [[_("Select OpenSCAP Proxy"), "None"],
6
6
  ] + SmartProxy.with_features(['Openscap']).map{|e| [e.name, e.id]},{},
7
- :onchange => "toggle_multiple_ok_button(this)" %>
7
+ :onchange => "tfm.hosts.table.toggleMultipleOkButton(this)" %>
8
8
  <% end %>
@@ -3,5 +3,5 @@
3
3
  :url => remove_policy_from_multiple_hosts_policies_path(:host_ids => params[:host_ids]) do |f| %>
4
4
  <%= selectable_f f, :id, [[_('Select Compliance Policy'), 'disabled'],
5
5
  ] + ForemanOpenscap::Policy.all.map{|e| [e.name, e.id]},{},
6
- :onchange => 'toggle_multiple_ok_button(this)' %>
6
+ :onchange => 'tfm.hosts.table.toggleMultipleOkButton(this)' %>
7
7
  <% end %>
@@ -4,5 +4,5 @@
4
4
  :url => update_multiple_hosts_policies_path(:host_ids => params[:host_ids]) do |f| %>
5
5
  <%= selectable_f f, :id, [[_("Select Compliance Policy"), "disabled"],
6
6
  ] + ForemanOpenscap::Policy.all.map{|e| [e.name, e.id]},{},
7
- :onchange => "toggle_multiple_ok_button(this)" %>
7
+ :onchange => "tfm.hosts.table.toggleMultipleOkButton(this)" %>
8
8
  <% end %>
@@ -65,6 +65,8 @@ Rails.application.routes.draw do
65
65
  get 'xml'
66
66
  end
67
67
  end
68
+ resources :scap_content_profiles, :only => %i[index]
69
+
68
70
  resources :tailoring_files, :except => %i[new edit] do
69
71
  member do
70
72
  get 'xml'
@@ -1,6 +1,4 @@
1
1
  class MoveArfReportsToReportsTable < ActiveRecord::Migration[4.2]
2
- # rubocop:disable Metrics/MethodLength
3
- # rubocop:disable Metrics/AbcSize
4
2
  def up
5
3
  execute 'DROP VIEW foreman_openscap_arf_report_breakdowns' if view_exists? 'foreman_openscap_arf_report_breakdowns'
6
4
  drop_table :foreman_openscap_xccdf_results
@@ -0,0 +1,24 @@
1
+ class MigratePortOverridesToInt < ActiveRecord::Migration[5.2]
2
+ def up
3
+ transform_lookup_values :to_i
4
+ end
5
+
6
+ def down
7
+ transform_lookup_values :to_s
8
+ end
9
+
10
+ private
11
+
12
+ def transform_lookup_values(method)
13
+ puppet_class = Puppetclass.find_by :name => 'foreman_scap_client'
14
+ return unless puppet_class
15
+ port_key = puppet_class.class_params.find_by :key => 'port'
16
+ return unless port_key
17
+ port_key.lookup_values.in_batches do |batch|
18
+ batch.each do |lookup_value|
19
+ lookup_value.value = lookup_value.value.send(method)
20
+ lookup_value.save
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,3 @@
1
- require 'deface'
2
-
3
1
  module ForemanOpenscap
4
2
  def self.with_katello?
5
3
  defined?(::Katello)
@@ -11,7 +9,6 @@ module ForemanOpenscap
11
9
  config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
12
10
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
13
11
  config.autoload_paths += Dir["#{config.root}/app/models"]
14
- config.autoload_paths += Dir["#{config.root}/app/overrides"]
15
12
  config.autoload_paths += Dir["#{config.root}/app/lib"]
16
13
  config.autoload_paths += Dir["#{config.root}/app/services"]
17
14
  config.autoload_paths += Dir["#{config.root}/lib"]
@@ -50,12 +47,11 @@ module ForemanOpenscap
50
47
 
51
48
  initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app|
52
49
  Foreman::Plugin.register :foreman_openscap do
53
- requires_foreman '>= 1.22'
50
+ requires_foreman '>= 1.24'
54
51
 
55
52
  apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]
56
53
 
57
- version = SETTINGS[:version]
58
- register_custom_status ForemanOpenscap::ComplianceStatus if version.major.to_i >= 1 && version.minor.to_i >= 10
54
+ register_custom_status ForemanOpenscap::ComplianceStatus
59
55
 
60
56
  # Add permissions
61
57
  security_block :foreman_openscap do
@@ -89,7 +85,8 @@ module ForemanOpenscap
89
85
  remove_policy_from_multiple_hosts] },
90
86
  :resource_type => 'ForemanOpenscap::Policy'
91
87
  permission :view_scap_contents, { :scap_contents => %i[index show auto_complete_search],
92
- 'api/v2/compliance/scap_contents' => %i[index show xml] },
88
+ 'api/v2/compliance/scap_contents' => %i[index show xml],
89
+ 'api/v2/compliance/scap_content_profiles' => %i[index] },
93
90
  :resource_type => 'ForemanOpenscap::ScapContent'
94
91
  permission :edit_scap_contents, { :scap_contents => %i[edit update],
95
92
  'api/v2/compliance/scap_contents' => [:update] },
@@ -112,7 +109,8 @@ module ForemanOpenscap
112
109
  permission :view_tailoring_files, { :tailoring_files => %i[index auto_complete_search xml],
113
110
  :policies => [:tailoring_file_selected],
114
111
  'api/v2/compliance/tailoring_files' => %i[show xml index],
115
- 'api/v2/compliance/policies' => [:tailoring] },
112
+ 'api/v2/compliance/policies' => [:tailoring],
113
+ 'api/v2/compliance/scap_content_profiles' => %i[index] },
116
114
  :resource_type => 'ForemanOpenscap::TailoringFile'
117
115
  permission :edit_tailoring_files, { :tailoring_files => %i[edit update],
118
116
  'api/v2/compliance/tailoring_files' => [:update] },
@@ -124,12 +122,14 @@ module ForemanOpenscap
124
122
  :resource_type => 'SmartProxy'
125
123
  end
126
124
 
127
- role "Compliance viewer", %i[view_arf_reports view_policies view_scap_contents view_tailoring_files view_openscap_proxies]
125
+ role "Compliance viewer", %i[view_arf_reports view_policies view_scap_contents view_tailoring_files view_openscap_proxies],
126
+ "Role granting read permissions to policy configuration, scan results and downloading reports."
128
127
  role "Compliance manager", %i[view_arf_reports view_policies view_scap_contents
129
128
  destroy_arf_reports edit_policies edit_scap_contents assign_policies
130
129
  create_policies create_scap_contents destroy_policies destroy_scap_contents
131
130
  create_tailoring_files view_tailoring_files edit_tailoring_files destroy_tailoring_files
132
- view_openscap_proxies]
131
+ view_openscap_proxies],
132
+ "Role granting all permissions to compliance features to non-admin users."
133
133
  role "Create ARF report", [:create_arf_reports] # special as only Proxy can create
134
134
 
135
135
  add_all_permissions_to_default_roles
@@ -200,6 +200,11 @@ module ForemanOpenscap
200
200
  add_controller_action_scope('HostsController', :index) do |base_scope|
201
201
  base_scope.preload(:policies)
202
202
  end
203
+
204
+ describe_host do
205
+ multiple_actions_provider :compliance_host_multiple_actions
206
+ overview_buttons_provider :compliance_host_overview_button
207
+ end
203
208
  end
204
209
  end
205
210