foreman_puppet 9.1.0 → 10.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fc8e5785dede7467f7304f44c23010d7141bb7c213a0473946eb9694de3ed73
4
- data.tar.gz: d12d7661d03481c64458dfab71fff925f7793b64c818db0fca55f69b77fde6bc
3
+ metadata.gz: bc7813b3e70470b1ede75609466fd1f395b2b24415a6fc30dea85fcf9431c10a
4
+ data.tar.gz: 3f6e2c28bdb0143c86e1182b201afb8eb81a9753c0fcd8198c5bf4996a3e995f
5
5
  SHA512:
6
- metadata.gz: 06f48bd2388561acc757d0227e9c29fbe3920ba40560a2cf4c72ee4f4936efa1fdb4759094451ae35e012aa89aa4312bb561d926bd80c175ee4f478055e8c2d9
7
- data.tar.gz: 86ae84580f218ccb38e4a801de6e4570b570d574217ef6bea04922af22d785fe6dc769fa3488640ebf0ae5aa8f5adff81777d4cc02f323fef7086816309f0658
6
+ metadata.gz: 5c2df904975315458ad27f09262c0025c9240d8750b89f2325a86bcd53abbd7c9e8d4d5ded37aebe594b069b86f3e0697be806652bfba01a8a42931a2b38cbca
7
+ data.tar.gz: 9708de0a826955c059856924d0fd206d76b2b21f8905e450b030c8876659f7f02692520cea3888701028e330947c4e556f1741dd3f21f6397124b1dc2281b1a9
@@ -9,19 +9,7 @@ module ForemanPuppet
9
9
 
10
10
  module PatchedMethods
11
11
  def visible_environments
12
- authorized_scope = ForemanPuppet::Environment.unscoped.authorized(:view_environments)
13
- authorized_scope = authorized_scope
14
- .joins(:taxable_taxonomies)
15
- .where('taxable_taxonomies.taxonomy_id' => taxonomy_ids[:organizations] + taxonomy_ids[:locations])
16
- result = authorized_scope.distinct.pluck(:name)
17
- if ::User.current.admin?
18
- # Admin users can also see Environments that do not have any organization or location, even when
19
- # organizations and locations are enabled.
20
- untaxed_env_ids = TaxableTaxonomy.where(taxable_type: 'ForemanPuppet::Environment').distinct.select(:taxable_id)
21
- untaxed_environments = ForemanPuppet::Environment.unscoped.where.not(id: untaxed_env_ids).pluck(:name)
22
- result += untaxed_environments
23
- end
24
- result
12
+ ForemanPuppet::Environment.authorized(:view_environments).pluck(:name)
25
13
  end
26
14
  end
27
15
  end
@@ -1,5 +1,5 @@
1
1
  Foreman::Plugin.register :foreman_puppet do
2
- requires_foreman '>= 3.13'
2
+ requires_foreman '>= 3.19'
3
3
  register_gettext
4
4
 
5
5
  # Add Global JS file for extending foreman-core components and routes
@@ -1,3 +1,3 @@
1
1
  module ForemanPuppet
2
- VERSION = '9.1.0'.freeze
2
+ VERSION = '10.0.0'.freeze
3
3
  end
@@ -24,8 +24,12 @@ module ForemanPuppet
24
24
  end
25
25
 
26
26
  test 'should show the list of environments visible as non-admin user' do
27
- # Non-admin user only sees environments in a taxonomy at least
27
+ # Non-admin user only sees environments in the same taxonomies at least
28
28
  setup_user 'view', 'environments'
29
+ # The user is in the same location as the environment, but in a
30
+ # different org. The org mismatch would make the environment invisible
31
+ # to the user.
32
+ User.current.organizations << environment.organizations.first
29
33
  assert_equal [environment.name], ::User.current.visible_environments
30
34
  end
31
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.0
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
@@ -404,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
404
404
  - !ruby/object:Gem::Version
405
405
  version: '0'
406
406
  requirements: []
407
- rubygems_version: 3.6.9
407
+ rubygems_version: 4.0.6
408
408
  specification_version: 4
409
409
  summary: Add Puppet features to Foreman
410
410
  test_files: