Bug #12712
closed
No searchable link for "Owner" in host properties in non-english languages
Added by René Kaak about 9 years ago.
Updated almost 5 years ago.
Description
If the language isnt english the link in host properties doenst work. This comes from hosts_helper.rb in line 263. Is there any reason for the if-else? It filters for the word "User" which obviously only works for english.
I've attached a screenshot of the code and my workaround.
Files
- Category set to Web Interface
- Difficulty set to trivial
The owner_type will only ever be in English, so it should actually check for if host.owner_type == "User"
as it's a DB column.
The second part of the conditional is used when a host is owned by a user group rather than a user, so it doesn't link to the individual user (it could actually link to a search for the group).
If you'd like to get this fixed, please do send the fix via a pull request (see http://theforeman.org/contribute.html).
The problem with my workaround is that it leads to a 500 error if the Owner is actually a usergroup. Need to find a way to fix this behaviour.. What is the search-context for usergroup? Trying to figure something out and will report back as soon as I understood some of the helpers better..
Yeah, that's why I think the conditional needs fixing instead, because a usergroup object won't have the ".login" that a user does.
It looks like you could use a search like this for hosts owned by a user group: owner_type = Usergroup and owner_id = #{host.owner.id}
(instead of user.login = ...).
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2963 added
- Pull request https://github.com/theforeman/foreman/pull/2965 added
- Status changed from Ready For Testing to New
- Status changed from New to Ready For Testing
- Assignee set to Tomer Brisker
- Pull request https://github.com/theforeman/foreman/pull/7315 added
- Fixed in Releases 2.0.0 added
- Status changed from Ready For Testing to Closed
- Category changed from Web Interface to Inventory
- Fixed in Releases 1.24.1 added
Also available in: Atom
PDF