10557: Tidy up users#setup controller.
authorTom Clegg <tom@curoverse.com>
Mon, 19 Jun 2017 21:31:19 +0000 (17:31 -0400)
committerTom Clegg <tom@curoverse.com>
Tue, 20 Jun 2017 14:25:48 +0000 (10:25 -0400)
commit74b3ad1f061185ca695e8bbead723b5212bbb06a
tree1665d24a62bcec208628f334d790dab0b39325fb
parent4db4e97167a25b519581fb5f4ebef2169464333e
10557: Tidy up users#setup controller.

Simplify long conditional, and fix bug where admin asks for repo
"username/reponame" but "username/username/reponame" gets created.

This also fixes an unpredictable API: Previously, if params included
{user:{uuid:X,email:Y}}, the setup API would either create a new user
with uuid X and email Y, or set up an existing user (ignoring Y),
depending on whether X was the UUID of an existing user. Now, passing
a "user" hash like this always tries to create a new user with
uuid=X (if given) and email=Y, and returns an error if the given UUID
is already in use.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curoverse.com>
services/api/app/controllers/arvados/v1/users_controller.rb
services/api/test/functional/arvados/v1/users_controller_test.rb
services/api/test/integration/users_test.rb