Bug 1310098

Summary: externalusers function does not support pagination properly
Product: [Red Hat Storage] Red Hat Storage Console Reporter: Martin Kudlej <mkudlej>
Component: coreAssignee: Timothy Asir <tjeyasin>
core sub component: authentication QA Contact: sds-qe-bugs
Status: CLOSED WONTFIX Docs Contact:
Severity: unspecified    
Priority: unspecified CC: mkudlej, nthomas, tjeyasin
Version: 2   
Target Milestone: ---   
Target Release: 3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhscon-ceph-0.0.23-1.el7scon.x86_64, rhscon-core-0.0.24-1.el7scon.x86_64, rhscon-ui-0.0.39-1.el7scon.noarch Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-23 04:06:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Kudlej 2016-02-19 12:47:46 UTC
Description of problem:
when user call:
/externalusers?search=test&pageno=1&pagesize=1
it returns more than one user.

Version-Release number of selected component (if applicable):
rhscon-core-0.0.8-4.el7.x86_64
rhscon-ceph-0.0.6-4.el7.x86_64
rhscon-ui-0.0.14-1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. configure ldap
2. try to call externalusers with pagination parameters

Comment 2 Timothy Asir 2016-03-02 12:02:00 UTC
Can you post here the output

Comment 3 Martin Kudlej 2016-03-04 11:05:15 UTC
It seems that above example works with search=test but:

/externalusers?pageno=1&pagesize=1"
{"totalcount":4,"startindex":1,"endindex":1,"users":null}

/externalusers?pageno=1&pagesize=2" - only one user and there should be 2 users in result
{"totalcount":4,"startindex":1,"endindex":2,"users":[{"username":"admin","email":"","role":"","groups":[""],"type":1,"status":false,"firstname":"","lastname":"Administrator","notificationenabled":false}]}

Number of user is correct but user "admin" is first so I expect that he will be in 1st page:
/externalusers?pageno=2&pagesize=1"
{"totalcount":4,"startindex":2,"endindex":2,"users":[{"username":"admin","email":"","role":"","groups":[""],"type":1,"status":false,"firstname":"","lastname":"Administrator","notificationenabled":false}]}

also I see just 3 users and totalcount is 4:
{"totalcount":4,"startindex":1,"endindex":4,"users":[
* {"username":"admin","email":"","role":"","groups":[""],"type":1,"status":false,"firstname":"","lastname":"Administrator","notificationenabled":false},
* {"username":"testldap","email":"testldap, testldap, testldap2","role":"","groups":[""],"type":1,"status":false,"firstname":"Test","lastname":"Ldap","notificationenabled":false},
* {"username":"testldap2","email":"testldap2.brq.redhat.com","role":"","groups":[""],"type":1,"status":false,"firstname":"test2","lastname":"last2","notificationenabled":false}]}

If numbers are not valid there should be error status return HTTP code instead of some default result. Not valid numbers for pagination:
- negative numbers
- zero
so queries like:
/externalusers?pageno=1&pagesize=-922
/externalusers?pageno=0&pagesize=90
/externalusers?pageno=0&pagesize=0
/externalusers?pageno=-10&pagesize=90

should return error status code.

Comment 4 Timothy Asir 2016-05-05 08:05:53 UTC
Patch sent to upstream for review: https://review.gerrithub.io/#/c/275285/

Comment 5 Martin Kudlej 2016-07-04 11:38:24 UTC
Tested with 
rhscon-ceph-0.0.29-1.el7scon.x86_64
rhscon-core-0.0.29-1.el7scon.x86_64
rhscon-core-selinux-0.0.29-1.el7scon.noarch
rhscon-ui-0.0.43-1.el7scon.noarch
queries are OK, but there is not ERROR message in case of incorrect query params. ->FailedQA