Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1613341

Summary: API doesn't return stored ssh public key for non admin user properly
Product: [oVirt] ovirt-engine Reporter: Lucie Leistnerova <lleistne>
Component: RestAPIAssignee: Ondra Machacek <omachace>
Status: CLOSED CURRENTRELEASE QA Contact: Lucie Leistnerova <lleistne>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.6.1CC: bugs, lsvaty, mperina
Target Milestone: ovirt-4.2.6Keywords: Automation, Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.6.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-03 15:07:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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