api icon indicating copy to clipboard operation
api copied to clipboard

Update user with different username creates new user

Open fbalak opened this issue 7 years ago • 0 comments

When any user (admin or normal) tries to change its user data via API:

curl -H 'Content-Type: application/json' -H 'Authorization: Bearer token' -XPUT -d '{"name":"Tom Hardy", "username":"thardy2", "email":"[email protected]", "role":"normal"}' http://127.0.0.1/api/1.0/users/thardy

and provide different username and email (same email returns message: is taken) than the one that the user already have then there is created a new user with the new provided username and empty role ("role": null) and the old user stays unchanged:

curl -H 'Content-Type: application/json' -H 'Authorization: Bearer token' -XGET http://127.0.0.1/api/1.0/users

Status: 200 OK
[{
  "email": "[email protected]",
  "username": "admin",
  "name": "Admin",
  "role": "admin",
  "email_notitifications": true
}, {
  "email": "[email protected]",
  "username": "thardy",
  "name": "Tom Hardy",
  "role": "admin",
  "email_notifications": false
}, {
  "email": "[email protected]",
  "username": "thardy2",
  "name": "Tom Hardy",
  "role": null,
  "email_notifications": false
}]

Tested with:

tendrl-ansible-1.5.4-1.el7.centos.noarch
tendrl-api-1.5.5-1.el7.centos.noarch
tendrl-api-httpd-1.5.5-1.el7.centos.noarch
tendrl-commons-1.5.5-1.el7.centos.noarch
tendrl-grafana-plugins-1.5.5-1.el7.centos.noarch
tendrl-grafana-selinux-1.5.4-2.el7.centos.noarch
tendrl-monitoring-integration-1.5.5-1.el7.centos.noarch
tendrl-node-agent-1.5.5-1.el7.centos.noarch
tendrl-notifier-1.5.5-1.el7.centos.noarch
tendrl-selinux-1.5.4-2.el7.centos.noarch
tendrl-ui-1.5.5-1.el7.centos.noarch

fbalak avatar Feb 14 '18 12:02 fbalak