Bug #17526

Taxonomy.ignore? does not work with "any context"

Added by Daniel Lobato Garcia 7 months ago. Updated 4 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Organizations and Locations
Target version:Team Daniel - Iteration 9
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4236, https://github.com/theforeman/foreman/pull/3961, https://github.com/theforeman/foreman/pull/4070
Story points-
Velocity based estimate-
Release1.15.0Release relationshipAuto

Description

In this scenario:

1. User has one organization - "E-Corp" - this organization allows the user to see every hostgroup (via selecting "all host groups" when editing the organization).
2. User has a location "Czech republic" that also includes all host groups through that checkbox.
3. User visits /hostgroups with "any context" selected, or "E-Corp/any location", or "any organization/Czech republic". The result is that the user does not see all host groups even though there's an organization/location combination (e-corp/czech republic) that should allow the user to see all host groups.

The reason is that when `Hostgroup.taxable_ids` is called `Organization.ignore?` does not realize that there it should look in all Organizations to see if any of them 'ignores' (has "all host groups" checked) the resource. The same thing happens with Locations.

The fix is to make `ignore?` aware the 'Organization.current == nil' means 'Any organization', not 'No organization'.

Associated revisions

Revision 2d9236b8
Added by Daniel Lobato Garcia 5 months ago

Fixes #17526 - Taxonomy.ignore? does not work with "any context"

In this scenario:

1. User has one organization - "E-Corp" - this organization allows the
user to see every hostgroup (via selecting "all host groups" when
editing the organization).

2. User has a location "Czech republic" that also includes all host
groups through that checkbox.

3. User visits /hostgroups with "any context" selected, or "E-Corp/any
location", or "any organization/Czech republic". The result is that the
user does not see all host groups even though there's an
organization/location combination (e-corp/czech republic) that should
allow the user to see all host groups.


The reason is that when `Hostgroup.taxable_ids` is called
`Organization.ignore?` does not realize that there it should look in all
Organizations to see if any of them 'ignores' (has "all host groups"
checked) the resource. The same thing happens with Locations.

The fix is to make `ignore?` aware the 'Organization.current == nil'
means 'Any organization', not 'No organization'.

Revision 2751a260
Added by Dominic Cleal 5 months ago

refs #17526 - reset taxonomy.current after each test

The shared "ignores the taxable_type if current taxonomy ignores it"
test failed to reset the taxonomy in teardown, instead using the setup
routine. This causes failures in different test cases when the test was
last to run.

History

#1 Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4070 added

#2 Updated by Daniel Lobato Garcia 7 months ago

  • Target version set to Team Daniel - iteration 6

#3 Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/foreman/pull/3961 added

#4 Updated by Daniel Lobato Garcia 5 months ago

  • Target version changed from Team Daniel - iteration 6 to Team Brad - Iteration 11

#5 Updated by Anonymous 5 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Dominic Cleal 5 months ago

  • Release set to 1.15.0

#7 Updated by The Foreman Bot 5 months ago

  • Pull request https://github.com/theforeman/foreman/pull/4236 added

#8 Updated by Brad Buckingham 4 months ago

  • Target version deleted (Team Brad - Iteration 11)

#9 Updated by Daniel Lobato Garcia 4 months ago

  • Target version set to Team Daniel - Iteration 9

Also available in: Atom PDF