Bug 1610660

Summary: New user can be created with Update user API call
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Filip Balák <fbalak>
Component: web-admin-tendrl-apiAssignee: Jeff Brown <jefbrown>
Status: CLOSED ERRATA QA Contact: Elena Bondarenko <ebondare>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rhgs-3.4CC: apaladug, ebondare, nthomas, rhinduja, rhs-bugs, sankarshan
Target Milestone: ---Keywords: ZStream
Target Release: RHGS 3.4.z Batch Update 1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tendrl-api-1.6.3-7.el7rhgs Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-31 08:45:18 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 Filip Balák 2018-08-01 07:15:22 UTC
Description of problem:
When username and email that differ from the current one is set in update user api call [1] then new user is created. When only different username is set then there is response `is taken` for email.

Version-Release number of selected component (if applicable):
tendrl-ansible-1.6.3-5.el7rhgs.noarch
tendrl-api-1.6.3-4.el7rhgs.noarch
tendrl-api-httpd-1.6.3-4.el7rhgs.noarch
tendrl-commons-1.6.3-9.el7rhgs.noarch
tendrl-grafana-plugins-1.6.3-7.el7rhgs.noarch
tendrl-grafana-selinux-1.5.4-2.el7rhgs.noarch
tendrl-monitoring-integration-1.6.3-7.el7rhgs.noarch
tendrl-node-agent-1.6.3-9.el7rhgs.noarch
tendrl-notifier-1.6.3-4.el7rhgs.noarch
tendrl-selinux-1.5.4-2.el7rhgs.noarch
tendrl-ui-1.6.3-8.el7rhgs.noarch

How reproducible:
100%

Steps to Reproduce:
1. Login to WA:
$ curl -H 'Content-Type: application/json' -d '{"username":"admin", "password": "adminuser"}' <server>/api/1.0/login
{"access_token":<token>}
2. Create new user:
curl -H 'Content-Type: application/json' -H 'Authorization: Bearer <token>' -XPOST -d '{"name":"Tom Hardy", "username":"thardy", "email":"thardy", "role":"admin", "password":"pass1234", "email_notifications": false}' <server>/api/1.0/users
3. Set different username and email to thardy user:
curl -H 'Content-Type: application/json' -H 'Authorization: Bearer <token>' -XPUT -d '{"username":"thardy2", "email":"thardy2"}' <server>/api/1.0/users/thardy
4. List users:
curl -H 'Content-Type: application/json' -H 'Authorization: Bearer f486f3e0e816ddb9eb508bb78c19d78d42bbbfd82b741064cb88920b12e0f0e2' -XGET http://fbalak-usm1-server.usmqe.lab.eng.brq.redhat.com/api/1.0/users

Actual results:
There are 3 users: admin, thardy and thardy2.

Expected results:
thardy2 user should not be created. Either thardy username should be changed to thardy2 or this operation should not be allowed.

Additional info:

[1] https://github.com/Tendrl/api/blob/master/docs/users.adoc#update-user

Comment 2 Anand Paladugu 2018-09-07 01:55:31 UTC
Description / steps and expected result look good to me.

Comment 4 Nishanth Thomas 2018-09-12 10:23:29 UTC
Fixed via https://github.com/Tendrl/api/pull/443

Comment 6 Elena Bondarenko 2018-09-26 06:48:14 UTC
Changing a username is not allowed anymore.

Comment 9 errata-xmlrpc 2018-10-31 08:45:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2018:3427