foreman_virt_who_configure 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '00828a04059a2127b00c406050e482d09a14c42a'
4
- data.tar.gz: cd043f391d7311cc3daf7dd63b8be65740c155c8
3
+ metadata.gz: 2b47a2020307dc453ed4b12012eb386bb82b4053
4
+ data.tar.gz: fa463aa1e278c5af50b1429bda158e25e0fbd7bf
5
5
  SHA512:
6
- metadata.gz: 72adb1410ffe0227b945b1d317992dda1d7d11a974f7dbdaeaca092ef9bc1787b6b02b8045dd507098b3587cbdf8c5a02260eeddb52806ce086087e36202d29a
7
- data.tar.gz: 78ae37c6993a476425536300217098bf06e4c81fa6b238f43e1703277f8a9c345287bf7b9919701bc50808b3d449c3bbb9271f71c3ff5b3bd8df3e3ba84ac0ed
6
+ metadata.gz: e366d45ad3a8f7cc2102787e23d013a1f27fd165dcc69c3fd15bea4f8bb83978b125b331808aeb670795ef3f360aaddb2c2782a85d8ccf3c3f01991de8dcdee6
7
+ data.tar.gz: 5ae7f7599c8273cd49eb3f41e3e2bd29c8aa66dedfe15ef3ef9554b19d83b29588514321ef9542410b7c74e20212d818b38b829de6e57300414a2fbb020cccfa
@@ -92,6 +92,10 @@ module ForemanVirtWhoConfigure
92
92
 
93
93
  protected
94
94
 
95
+ def controller_permission
96
+ 'virt_who_config'
97
+ end
98
+
95
99
  def action_permission
96
100
  case params[:action]
97
101
  when 'deploy_script'
@@ -85,6 +85,10 @@ module ForemanVirtWhoConfigure
85
85
  end
86
86
  end
87
87
 
88
+ def controller_permission
89
+ 'virt_who_config'
90
+ end
91
+
88
92
  private
89
93
 
90
94
  def apply_organization_filter(scope)
@@ -4,9 +4,9 @@ module ForemanVirtWhoConfigure
4
4
 
5
5
  def new_config_link(options = {}, html_options = {})
6
6
  if ApplicationHelper.instance_methods.include?(:new_link)
7
- new_link(_("Create Config"), options, html_options)
7
+ new_link(_("Create Config"), options.merge(:permission => 'create_virt_who_config'), html_options)
8
8
  else
9
- display_link_if_authorized(_("New Config"), hash_for_new_foreman_virt_who_configure_config_path, html_options)
9
+ display_link_if_authorized(_("New Config"), hash_for_new_foreman_virt_who_configure_config_path.merge(:permission => 'create_virt_who_config'), html_options)
10
10
  end
11
11
  end
12
12
 
@@ -47,7 +47,7 @@ module ForemanVirtWhoConfigure
47
47
 
48
48
  def virt_who_output(format = nil)
49
49
  result = ''
50
- result += "#!/usr/bin/bash\n" if format == :bash_script
50
+ result += "#!/bin/bash\n" if format == :bash_script
51
51
  result += <<EOS
52
52
  heading() {
53
53
  echo -e "\\n== $1 =="
@@ -0,0 +1,21 @@
1
+ module ForemanVirtWhoConfigure
2
+ class Cleaner
3
+ def clean_up!
4
+ User.as_anonymous_admin do
5
+ remove_configurations
6
+ remove_hidden_auth_sources
7
+ end
8
+ end
9
+
10
+ private
11
+
12
+ def remove_hidden_auth_sources
13
+ AuthSourceHiddenWithAuthentication.destroy_all
14
+ end
15
+
16
+ # also removes service users
17
+ def remove_configurations
18
+ Config.destroy_all
19
+ end
20
+ end
21
+ end
@@ -14,12 +14,12 @@
14
14
  <tbody>
15
15
  <% @configs.each do |config| %>
16
16
  <tr>
17
- <td class="display-two-pane ellipsis"><%= link_to_if_authorized config.name, hash_for_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer) %></td>
17
+ <td class="display-two-pane ellipsis"><%= link_to_if_authorized config.name, hash_for_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer, :permission => 'view_virt_who_config') %></td>
18
18
  <td><%= config.humanized_interval %></td>
19
19
  <td><%= config_report_status(config) %></td>
20
20
  <td class="col-md-1"><%= action_buttons(
21
- display_link_if_authorized(_('Edit'), hash_for_edit_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer)),
22
- display_delete_if_authorized((hash_for_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer)), :data => { :confirm => _("Delete virt-who configuration %s?") % config.name })
21
+ display_link_if_authorized(_('Edit'), hash_for_edit_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer, :permission => 'edit_virt_who_config')),
22
+ display_delete_if_authorized((hash_for_foreman_virt_who_configure_config_path(:id => config).merge(:auth_object => config, :authorizer => authorizer, :permission => 'destroy_virt_who_config')), :data => {:confirm => _("Delete virt-who configuration %s?") % config.name})
23
23
  ) %></td>
24
24
  </tr>
25
25
  <% end %>
@@ -13,7 +13,7 @@
13
13
  <div class="col-md-2">
14
14
  <div class="pull-right">
15
15
  <p>
16
- <%= link_to _('Edit this configuration'), edit_foreman_virt_who_configure_config_path(@config), :class => 'btn btn-default' %>
16
+ <%= display_link_if_authorized _('Edit this configuration'), hash_for_edit_foreman_virt_who_configure_config_path(@config).merge(:permission => 'show_virt_who_config', :auth_object => @config), :class => 'btn btn-default' %>
17
17
  </p>
18
18
  </div>
19
19
  </div>
@@ -1,3 +1,3 @@
1
1
  module ForemanVirtWhoConfigure
2
- VERSION = '0.1.5'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
@@ -2,11 +2,9 @@ require 'rake/testtask'
2
2
 
3
3
  # Tasks
4
4
  namespace :foreman_virt_who_configure do
5
- namespace :example do
6
- desc 'Example Task'
7
- task task: :environment do
8
- # Task goes here
9
- end
5
+ desc 'Clean default data created by this plugin, this will permanently delete the data!'
6
+ task cleanup: :environment do
7
+ ForemanVirtWhoConfigure::Cleaner.new.clean_up!
10
8
  end
11
9
  end
12
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_virt_who_configure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman virt-who-configure team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -76,6 +76,7 @@ files:
76
76
  - app/models/foreman_virt_who_configure/config.rb
77
77
  - app/models/foreman_virt_who_configure/output_generator.rb
78
78
  - app/models/foreman_virt_who_configure/service_user.rb
79
+ - app/services/foreman_virt_who_configure/cleaner.rb
79
80
  - app/services/sso/basic_with_hidden.rb
80
81
  - app/views/dashboard/_foreman_virt_who_configs_status_widget.html.erb
81
82
  - app/views/foreman_virt_who_configure/api/v2/configs/base.json.rabl