Bug 1613341 - API doesn't return stored ssh public key for non admin user properly
Summary: API doesn't return stored ssh public key for non admin user properly
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.2.6.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.6
: ---
Assignee: Ondra Machacek
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-07 12:22 UTC by Lucie Leistnerova
Modified: 2018-09-03 15:07 UTC (History)
3 users (show)

Fixed In Version: ovirt-engine-4.2.6.4
Clone Of:
Environment:
Last Closed: 2018-09-03 15:07:22 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+
rule-engine: blocker+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 93648 0 master MERGED core: Return sshpublickeys valid for userID 2020-07-30 14:00:53 UTC
oVirt gerrit 93766 0 ovirt-engine-4.2 MERGED core: Return sshpublickeys valid for userID 2020-07-30 14:00:53 UTC

Description Lucie Leistnerova 2018-08-07 12:22:57 UTC
Description of problem:
Calling /users/<user_id>/sshpublickeys does not return stored ssh keys for non admin user, but for admin user.

Version-Release number of selected component (if applicable):
ovirt-engine-restapi-4.2.6-0.1.el7ev.noarch

How reproducible: always


Steps to Reproduce:
1. add new user to engine, set UserRole permission
2. log into VM portal
3. go to Options dialog and save public ssh key
4. ssh key is loaded in dialog also after logout/login
5. call api:
curl -k -u admin@internal:password -H "Prefer: persistent-auth" https://engine/ovirt-engine/api/users/<user_id>/sshpublickeys


Actual results: no ssh key returned
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ssh_public_keys/>


Expected results: stored ssh key returned, e.g.:
<ssh_public_keys>
    <ssh_public_key href="/ovirt-engine/api/users/49210e66-7c2c-4ce9-87fa-e8c3609dd8dd/sshpublickeys/e52ddd30-f6a2-4d8f-b305-1dde462870b7" id="e52ddd30-f6a2-4d8f-b305-1dde462870b7">
        <content>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDN...</content>
        <user href="/ovirt-engine/api/users/49210e66-7c2c-4ce9-87fa-e8c3609dd8dd" id="49210e66-7c2c-4ce9-87fa-e8c3609dd8dd"/>
    </ssh_public_key>
</ssh_public_keys>

6. log into webadmin portal as admin user
7. go to Options dialog and save public ssh key
8. call again api for the non admin user

Actual results: stored ssh key for admin user is returned, instead the one for non admin user



Additional info:
No error in engine log.
I see the ssh key in Options dialog (VM portal) and also in database for the non admin user:

select p.user_id, u.username, p.ssh_public_key from user_profiles p join users u on (u.user_id = p.user_id)  where u.user_id='49210e66-7c2c-4ce9-87fa-e8c3609dd8dd';
user_id                              | username | ssh_public_key
49210e66-7c2c-4ce9-87fa-e8c3609dd8dd | test2    | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYds...

Comment 1 Red Hat Bugzilla Rules Engine 2018-08-08 12:06:21 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 2 Lucie Leistnerova 2018-08-23 07:43:02 UTC
API returns appropriate ssh keys for given user

verified in ovirt-engine-restapi-4.2.6.4-0.0.master.20180822115635.gitde4f2c3.el7.noarch

Comment 3 Raz Tamir 2018-08-28 19:30:54 UTC
QE verification bot: the bug was verified upstream


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