Bug 1470765 - Getting 'Validation failed" when trying to register a host via subscription-manager with non-admin user
Getting 'Validation failed" when trying to register a host via subscription-m...
Status: CLOSED DUPLICATE of bug 1511481
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Registration (Show other bugs)
6.3.0
x86_64 Linux
unspecified Severity high (vote)
: Beta
: --
Assigned To: satellite6-bugs
Renzo Nuccitelli
: Regression, Triaged
Depends On: 1505639
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-13 11:22 EDT by Djebran Lezzoum
Modified: 2018-01-19 08:22 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-01-18 10:08:47 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Comment 8 Eric Helms 2017-09-28 09:20:49 EDT
Djebran,

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.
Comment 9 Roman Plevka 2017-10-04 08:40:56 EDT
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 

tests.foreman.cli.test_contentview.ContentViewTestCase.test_positive_subscribe_host_with_restricted_user_permissions

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)
Comment 11 Renzo Nuccitelli 2017-10-24 14:30:20 EDT
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.
Comment 14 Renzo Nuccitelli 2017-10-31 13:40:11 EDT
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.
Comment 17 Marek Hulan 2018-01-18 10:08:47 EST
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 ***
Comment 18 Djebran Lezzoum 2018-01-19 08:22:39 EST
Many thanks Marek for you resolution.

Note You need to log in before you can comment on or make changes to this bug.