New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #17526 - Taxonomy.ignore? does not work with "any context" #4070
Conversation
@dLobatog, thanks for your PR! By analyzing the history of the files in this pull request, we identified @isratrade, @ares and @abenari to be potential reviewers. |
should_not allow_value(' ').for(:name) | ||
# Taxonomy 1 is already used by a fixture | ||
should_not allow_value("#{taxonomy_name} 1").for(:name) | ||
should_not allow_value("#{'a' * 256}").for(:name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to_s over string interpolation.
assert_equal _("is too long (maximum is 0 characters)"), taxonomy.errors[:name].first | ||
end | ||
|
||
test 'ignores the taxable_type if current taxonomy ignores it' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are the only new tests, the rest of them are just removing the duplication between location_test and organization_test and moving them both to a module
Tons of tests broke, setting to WoC |
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'.
@theforeman-bot ok to test |
Test failure in Katello is due to https://github.com/Katello/katello/pull/6480/files |
Thanks @dLobatog ! |
In this scenario:
User has one organization - "E-Corp" - this organization allows the
user to see every hostgroup (via selecting "all host groups" when
editing the organization).
User has a location "Czech republic" that also includes all host
groups through that checkbox.
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 calledOrganization.ignore?
does not realize that there it should look in allOrganizations 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'.