Bug 1470765 - Getting 'Validation failed" when trying to register a host via subscription-manager with non-admin user
Summary: Getting 'Validation failed" when trying to register a host via subscription-m...
Keywords:
Status: CLOSED DUPLICATE of bug 1511481
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.3.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Renzo Nuccitelli
URL:
Whiteboard:
Depends On: 1505639
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-13 15:22 UTC by Djebran Lezzoum
Modified: 2021-07-21 11:18 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-01-18 15:08:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Comment 8 Eric Helms 2017-09-28 13:20:49 UTC
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 12:40:56 UTC
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 18:30:20 UTC
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 17:40:11 UTC
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 15:08:47 UTC
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 13:22:39 UTC
Many thanks Marek for you resolution.


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