Bug 1731121 - 'search' query for /events request don't work correctly
Summary: 'search' query for /events request don't work correctly
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: future
Hardware: Unspecified
OS: Unspecified
Target Milestone: ovirt-4.3.7
: ---
Assignee: Ori Liel
QA Contact: Guilherme Santos
Depends On:
TreeView+ depends on / blocked
Reported: 2019-07-18 11:15 UTC by biakymet
Modified: 2019-11-21 12:44 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Last Closed: 2019-11-21 12:44:38 UTC
oVirt Team: Infra
pm-rhel: ovirt-4.3+

Attachments (Terms of Use)
Engine log for request (1.66 KB, text/plain)
2019-07-18 11:15 UTC, biakymet
no flags Details

System ID Private Priority Status Summary Last Updated
oVirt gerrit 102588 0 'None' 'MERGED' 'restapi: Enable searching Events for non-admin users' 2019-11-11 10:56:03 UTC
oVirt gerrit 103209 0 'None' 'MERGED' 'restapi: Enable searching Events for non-admin users' 2019-11-11 10:56:03 UTC

Description biakymet 2019-07-18 11:15:44 UTC
Created attachment 1591742 [details]
Engine log for request

Description of problem:
When trying to send /events request with `search` query as regular user, it don't filter events. But if send same request as admin everything working fine. 

Version-Release number of selected component (if applicable):
Version 4.4.0-0.0.master.20190619122153.git40cb8bc.el7

How reproducible:

Steps to Reproduce:
Send request: https://[engine]/ovirt-engine/api/events?search=severity%3Derror as regular user.

Actual results:
Events in response not filtered.

Expected results:
In response only events with `severity=error`

Additional info:
It seems like problem with header `Filter: true`, because if set that header for admin, result not filtered as well.

Comment 3 Guilherme Santos 2019-11-06 09:38:39 UTC
Failed on:

Regular user not able to query any request at all - neither unfiltered nor filtered.

Comment 4 Ori Liel 2019-11-11 11:04:34 UTC
I've re-verified and it is working for me. 

Perhaps we are not verifying in the same way; let me describe what I have done: 

1) create a non-admin user (ori)
2) create a new Cluster (cluster_1)
3) grant ori UserRole on cluster_1

At this point GET .../api/events run as ori should return exactly one event: the addition of cluster_1

now we test the search: 

  http://.../ovirt-engine/api/events?search=severity%3Dnormal  - should return a list with one item - this event
  http://.../ovirt-engine/api/events?search=severity%3Dwarning - should return an empay list

This proves that performing a search as a regular (non-admin) user works. 

Does this seem like reasonable verification? Is it similar to the verification that you've done?

Comment 5 Guilherme Santos 2019-11-12 09:08:12 UTC
Hi. I could verify now! The thing was, I was assigning system-wide UserRole for my user instead of assigning it for a specific Cluster or Data Center.
I'm not sure if that should be filled as bug or not. 

Either way, verified on:

1. Created new user u0
2. Assigned UserRole to u0 on the Cluster (and later on the Data Center) to be used
3a. Made GET request on .../api/events
3b. Made GET request on .../api/events?search=severity%3Derror 
3c. Made GET request on .../api/events?search=severity%3Dnormal 

a. Got all events
b. Got only error status events
c. Got only normal status events

Comment 6 Sandro Bonazzola 2019-11-21 12:44:38 UTC
This bugzilla is included in oVirt 4.3.7 release, published on November 21st 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.7 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.

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