foreman_openscap 0.9.2 → 0.9.3

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb +31 -0
  3. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +2 -1
  4. data/app/helpers/policies_helper.rb +1 -1
  5. data/app/lib/proxy_api/openscap.rb +4 -1
  6. data/app/models/foreman_openscap/policy.rb +1 -1
  7. data/app/models/foreman_openscap/scap_content.rb +1 -1
  8. data/app/models/foreman_openscap/tailoring_file.rb +1 -1
  9. data/app/views/hosts/select_multiple_openscap_proxy.html.erb +8 -0
  10. data/config/routes.rb +2 -0
  11. data/lib/foreman_openscap/engine.rb +4 -1
  12. data/lib/foreman_openscap/version.rb +1 -1
  13. metadata +4 -29
  14. data/locale/de/foreman_openscap.edit.po +0 -1039
  15. data/locale/de/foreman_openscap.po.time_stamp +0 -0
  16. data/locale/en_GB/foreman_openscap.edit.po +0 -1039
  17. data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
  18. data/locale/es/foreman_openscap.edit.po +0 -1039
  19. data/locale/es/foreman_openscap.po.time_stamp +0 -0
  20. data/locale/fr/foreman_openscap.edit.po +0 -1039
  21. data/locale/fr/foreman_openscap.po.time_stamp +0 -0
  22. data/locale/gl/foreman_openscap.edit.po +0 -1039
  23. data/locale/gl/foreman_openscap.po.time_stamp +0 -0
  24. data/locale/it/foreman_openscap.edit.po +0 -1039
  25. data/locale/it/foreman_openscap.po.time_stamp +0 -0
  26. data/locale/ja/foreman_openscap.edit.po +0 -1039
  27. data/locale/ja/foreman_openscap.po.time_stamp +0 -0
  28. data/locale/ko/foreman_openscap.edit.po +0 -1039
  29. data/locale/ko/foreman_openscap.po.time_stamp +0 -0
  30. data/locale/pt_BR/foreman_openscap.edit.po +0 -1039
  31. data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
  32. data/locale/ru/foreman_openscap.edit.po +0 -1040
  33. data/locale/ru/foreman_openscap.po.time_stamp +0 -0
  34. data/locale/sv_SE/foreman_openscap.edit.po +0 -1039
  35. data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
  36. data/locale/zh_CN/foreman_openscap.edit.po +0 -1039
  37. data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
  38. data/locale/zh_TW/foreman_openscap.edit.po +0 -1039
  39. data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1feb561a50f25dc010a75ac0cc3ef91b62c92e06
4
- data.tar.gz: 61ed2b4a83b4983901a761cab721be88fd7cacf0
3
+ metadata.gz: 2b0b56c6f69891762fa3bbcbd59f7de1883a2c3c
4
+ data.tar.gz: 9c3e7c7ce9fa65769ef3a8a46ca360e0efe2dae8
5
5
  SHA512:
6
- metadata.gz: d6326a6c5e111b39324e357d69f08be04562923bebd7bfc9bcfa9d6118156e86341cc8b4abd30bdaf29ed478a11659abd97966879d62f4acfc9796a49f234a3c
7
- data.tar.gz: b77dac15c66aae94c00ebb8f037eeaa5e8ed1ee7fff03cc50bd8aa56927024df1a307559ff6c132f26ff11438bf015fab4956c267c08e522c55bc7457489d0ee
6
+ metadata.gz: 4732cb483607a6d37de0ee738517d0e12ab3ab718f9fb43308f831a9f3cb19934667d5ba8fb434bd1244c929acf35e0890f5a24b9736c4d1fe22b09ff1fa8b65
7
+ data.tar.gz: 3e440693f385abe344f79b7b810c3b16d7603587268b3427566143dfed4b58867ea7500d2283aa520c29b4d2326d4d88a4f8a5a0849ef40948e964077374b69e
@@ -10,5 +10,36 @@ module ForemanOpenscap
10
10
  @openscap_proxy = @hostgroup.openscap_proxy
11
11
  super
12
12
  end
13
+
14
+ def select_multiple_openscap_proxy
15
+ find_multiple
16
+ end
17
+
18
+ def update_multiple_openscap_proxy
19
+ if (id = params['smart_proxy']['id'])
20
+ find_multiple
21
+ smart_proxy = ::SmartProxy.find(id)
22
+ @hosts.each do |host|
23
+ host.openscap_proxy = smart_proxy
24
+ host.save!
25
+ end
26
+ notice _("Updated hosts: Assigned with OpenSCAP Proxy: %s") % smart_proxy.name
27
+ redirect_to hosts_path
28
+ else
29
+ error _('No OpenSCAP Proxy selected.')
30
+ redirect_to(select_multiple_openscap_proxy_hosts_path)
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def action_permission
37
+ case params[:action]
38
+ when 'select_multiple_openscap_proxy', 'update_multiple_openscap_proxy'
39
+ :edit
40
+ else
41
+ super
42
+ end
43
+ end
13
44
  end
14
45
  end
@@ -2,7 +2,8 @@ module ForemanOpenscap
2
2
  module HostsHelperExtensions
3
3
  def multiple_actions
4
4
  super + [[_('Assign Compliance Policy'), select_multiple_hosts_policies_path],
5
- [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path]]
5
+ [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path],
6
+ [_('Change OpenSCAP Proxy'), select_multiple_openscap_proxy_hosts_path]]
6
7
  end
7
8
 
8
9
  def name_column(record)
@@ -88,7 +88,7 @@ module PoliciesHelper
88
88
  end
89
89
 
90
90
  def previous_link(form)
91
- previous = content_tag(:span, :class => 'glyphicon glyphicon-chevron-left')
91
+ previous = content_tag(:span, "", :class => 'glyphicon glyphicon-chevron-left')
92
92
  content_tag(:div, :class => 'pull-left') do
93
93
  link_to(previous.html_safe, '#', :class => 'btn btn-default', :onclick => "previous_step('#{@policy.previous_step}')")
94
94
  end
@@ -21,7 +21,10 @@ module ::ProxyAPI
21
21
  raise ::ProxyAPI::ProxyException.new(url, e, N_("Request timed out. Please try increasing Settings -> proxy_request_timeout"))
22
22
  rescue RestClient::ResourceNotFound => e
23
23
  raise ::ProxyAPI::ProxyException.new(url, e,
24
- N_("Could not validate %s. Please make sure you have appropriate proxy version to use this functionality") % scap_file.class)
24
+ N_("Could not validate %s. Please make sure you have appropriate proxy version to use this functionality") % type.humanize)
25
+ rescue => e
26
+ raise ::ProxyAPI::ProxyException.new(url, e,
27
+ N_("Could not validate %{file_type}. Error %{error}") % { :file_type => type.humanize, :error => e.message })
25
28
  end
26
29
 
27
30
  def policy_html_guide(scap_file, policy)
@@ -1,10 +1,10 @@
1
1
  require 'rack/utils'
2
2
  module ForemanOpenscap
3
3
  class Policy < ApplicationRecord
4
+ audited
4
5
  include Authorizable
5
6
  include Taxonomix
6
7
  attr_writer :current_step, :wizard_initiated
7
- audited
8
8
 
9
9
  belongs_to :scap_content
10
10
  belongs_to :scap_content_profile
@@ -1,9 +1,9 @@
1
1
  module ForemanOpenscap
2
2
  class ScapContent < ApplicationRecord
3
+ audited :except => [:scap_file]
3
4
  include Authorizable
4
5
  include Taxonomix
5
6
  include DataStreamContent
6
- audited :except => [:scap_file]
7
7
 
8
8
  has_many :scap_content_profiles, :dependent => :destroy
9
9
  has_many :policies
@@ -1,9 +1,9 @@
1
1
  module ForemanOpenscap
2
2
  class TailoringFile < ApplicationRecord
3
+ audited :except => [:scap_file]
3
4
  include Authorizable
4
5
  include Taxonomix
5
6
  include DataStreamContent
6
- audited :except => [:scap_file]
7
7
 
8
8
  has_many :policies
9
9
  has_many :scap_content_profiles, :dependent => :destroy
@@ -0,0 +1,8 @@
1
+ <%= render 'selected_hosts', :hosts => @hosts %>
2
+
3
+ <%= form_for :smart_proxy,
4
+ :url => update_multiple_openscap_proxy_hosts_path(:host_ids => params[:host_ids]) do |f| %>
5
+ <%= selectable_f f, :id, [[_("Select OpenSCAP Proxy"), "None"],
6
+ ] + SmartProxy.with_features(['Openscap']).map{|e| [e.name, e.id]},{},
7
+ :onchange => "toggle_multiple_ok_button(this)" %>
8
+ <% end %>
data/config/routes.rb CHANGED
@@ -93,6 +93,8 @@ Foreman::Application.routes.draw do
93
93
  resources :hosts do
94
94
  collection do
95
95
  post 'openscap_proxy_changed'
96
+ post 'select_multiple_openscap_proxy'
97
+ post 'update_multiple_openscap_proxy'
96
98
  end
97
99
  end
98
100
 
@@ -92,7 +92,10 @@ module ForemanOpenscap
92
92
  permission :destroy_scap_contents, { :scap_contents => [:destroy],
93
93
  'api/v2/compliance/scap_contents' => [:destroy] },
94
94
  :resource_type => 'ForemanOpenscap::ScapContent'
95
- permission :edit_hosts, { :hosts => [:openscap_proxy_changed] }, :resource_type => "Host"
95
+ permission :edit_hosts, { :hosts => %i[openscap_proxy_changed
96
+ select_multiple_openscap_proxy
97
+ update_multiple_openscap_proxy] },
98
+ :resource_type => "Host"
96
99
  permission :edit_hostgroups, { :hostgroups => [:openscap_proxy_changed] }, :resource_type => "Hostgroup"
97
100
  permission :create_tailoring_files, { :tailoring_files => %i[create new],
98
101
  'api/v2/compliance/tailoring_files' => [:create] },
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "0.9.2".freeze
2
+ VERSION = "0.9.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - slukasik@redhat.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-13 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -138,6 +138,7 @@ files:
138
138
  - app/views/foreman_openscap/policy_mailer/_list.erb
139
139
  - app/views/foreman_openscap/policy_mailer/_policy.erb
140
140
  - app/views/foreman_openscap/policy_mailer/policy_summary.erb
141
+ - app/views/hosts/select_multiple_openscap_proxy.html.erb
141
142
  - app/views/job_templates/run_openscap_scans.erb
142
143
  - app/views/policies/_form.html.erb
143
144
  - app/views/policies/_list.html.erb
@@ -233,59 +234,33 @@ files:
233
234
  - lib/tasks/foreman_openscap_tasks.rake
234
235
  - locale/Makefile
235
236
  - locale/de/LC_MESSAGES/foreman_openscap.mo
236
- - locale/de/foreman_openscap.edit.po
237
237
  - locale/de/foreman_openscap.po
238
- - locale/de/foreman_openscap.po.time_stamp
239
238
  - locale/en_GB/LC_MESSAGES/foreman_openscap.mo
240
- - locale/en_GB/foreman_openscap.edit.po
241
239
  - locale/en_GB/foreman_openscap.po
242
- - locale/en_GB/foreman_openscap.po.time_stamp
243
240
  - locale/es/LC_MESSAGES/foreman_openscap.mo
244
- - locale/es/foreman_openscap.edit.po
245
241
  - locale/es/foreman_openscap.po
246
- - locale/es/foreman_openscap.po.time_stamp
247
242
  - locale/foreman_openscap.pot
248
243
  - locale/fr/LC_MESSAGES/foreman_openscap.mo
249
- - locale/fr/foreman_openscap.edit.po
250
244
  - locale/fr/foreman_openscap.po
251
- - locale/fr/foreman_openscap.po.time_stamp
252
245
  - locale/gl/LC_MESSAGES/foreman_openscap.mo
253
- - locale/gl/foreman_openscap.edit.po
254
246
  - locale/gl/foreman_openscap.po
255
- - locale/gl/foreman_openscap.po.time_stamp
256
247
  - locale/it/LC_MESSAGES/foreman_openscap.mo
257
- - locale/it/foreman_openscap.edit.po
258
248
  - locale/it/foreman_openscap.po
259
- - locale/it/foreman_openscap.po.time_stamp
260
249
  - locale/ja/LC_MESSAGES/foreman_openscap.mo
261
- - locale/ja/foreman_openscap.edit.po
262
250
  - locale/ja/foreman_openscap.po
263
- - locale/ja/foreman_openscap.po.time_stamp
264
251
  - locale/ko/LC_MESSAGES/foreman_openscap.mo
265
- - locale/ko/foreman_openscap.edit.po
266
252
  - locale/ko/foreman_openscap.po
267
- - locale/ko/foreman_openscap.po.time_stamp
268
253
  - locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
269
- - locale/pt_BR/foreman_openscap.edit.po
270
254
  - locale/pt_BR/foreman_openscap.po
271
- - locale/pt_BR/foreman_openscap.po.time_stamp
272
255
  - locale/ru/LC_MESSAGES/foreman_openscap.mo
273
- - locale/ru/foreman_openscap.edit.po
274
256
  - locale/ru/foreman_openscap.po
275
- - locale/ru/foreman_openscap.po.time_stamp
276
257
  - locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
277
- - locale/sv_SE/foreman_openscap.edit.po
278
258
  - locale/sv_SE/foreman_openscap.po
279
- - locale/sv_SE/foreman_openscap.po.time_stamp
280
259
  - locale/zanata.xml
281
260
  - locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
282
- - locale/zh_CN/foreman_openscap.edit.po
283
261
  - locale/zh_CN/foreman_openscap.po
284
- - locale/zh_CN/foreman_openscap.po.time_stamp
285
262
  - locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
286
- - locale/zh_TW/foreman_openscap.edit.po
287
263
  - locale/zh_TW/foreman_openscap.po
288
- - locale/zh_TW/foreman_openscap.po.time_stamp
289
264
  - test/factories/arf_report_factory.rb
290
265
  - test/factories/asset_factory.rb
291
266
  - test/factories/compliance_host_factory.rb
@@ -323,7 +298,7 @@ files:
323
298
  - test/unit/services/report_dashboard/data_test.rb
324
299
  - test/unit/services/tailoring_files_proxy_check_test.rb
325
300
  - test/unit/tailoring_file_test.rb
326
- homepage: https://github.com/OpenSCAP/foreman_openscap
301
+ homepage: https://github.com/theforeman/foreman_openscap
327
302
  licenses:
328
303
  - GPL-3.0
329
304
  metadata: {}