From my previous comments and my own testing, I believe this bug if not a bug. As the validation message indicates, if you add the user to a location or the hosts location then the registration occurs as expected. Given the user is not an administrator, you must ensure that they are in the same location as the host you are attempting to register. If you only have one location, then means ensuring the user has that location added to it. I am putting this back ON_QA to be re-tested with this information.
I did some experiments on this too and was able to reproduce the behavior and can confirm, assigning user to the same location as is specified as a global setting (default location for hosts) works.
@djebran, from your last statement in the description i can see, you're stating the opposite. Could you double check that assigning location to user works? Looking into
I can see we don't assign it.
- Anyway, the error message is a bug i think: "Validation failed: Is owned by does not belong into host's location"
looks like we print out the field description instead of its value: "Is owned by".
- Yet another issue i discovered and which is possibly a bug is the conflict during re-registering a host owned by admin with different user:
when i re-register the host owned by Admin using another, non-admin user (mostly Viewer role + all host-related permissions).
I'm getting a "Validation failed: Owner There is no owner with id 3 and type User" error - this is obviously a permission issue, where my user can't see Admin user (id 3)
When I was trying to verify this bug I hit another one: https://bugzilla.redhat.com/show_bug.cgi?id=1505639. So until it is fixed, this one can't be verified.
When I've tried to register the host and the user had no Location I got the same validation error. But once I've added Default Location to the user, I was able to register the content host. Tests performed on Satellite 6.3 snap 22. This I'm moving this issue to VERIFIED.
Bottom line: this is not a bug, because
1) new hosts are created into location that is globally set through settings
2) if user is not assigned to this location, he/she can't create any hosts
or any other objects in it, that would be security issue
3) you need to have the registrar user assigned to location (and organization) that is set as default for new hosts
I suggest we close this as NOTABUG and QE opens a new RFE that we need subscription manager parameter to allow specifying which location user register host to. That is already covered as BZ 1511481.
We could try to determine one of user's locations but that is suboptimal. For discovery we allow customization through custom facts, perhaps we could do the same with rhsm facts. Or we should add user settings so each user could tell which location he register hosts to. All of these alternative solutions are RFEs though.
Djebran, Renzo, Roman, I'm closing now, please reopen if I misunderstood something.
*** This bug has been marked as a duplicate of bug 1511481 ***
Many thanks Marek for you resolution.