Setting owner does not work under non-admin user in some taxonomy
|Assigned To:||Marek Hulán|
|Category:||Organizations and Locations|
|Target version:||Team Marek Iteration 25|
|Found in release:||Pull request:||https://github.com/theforeman/foreman/pull/4954|
|Velocity based estimate||-|
The host owner association is polymorphic belongs_to and in case we're in specific Organization, it applies default scope from Taxonomix, therefore it can't find owner by just calling self.owner. This causes problems in Katello when register content host in a specific org.
The issue can be probably reproduced also in core, make sure a host is owner by e.g. admin who's not in any organization, then under user in specific org/loc try to edit it. The before_validation fitler that sets the owner will fail to find self.owner even though self.owner_id is 3 and self.owner_type is admin.
The similar fix like for #16363 should help