Reviewing 6254-groups-during-setup at cdec4d7
I'm sorry this wasn't spelled out better in the story description, but unfortunately, you're manipulating the wrong kind of can_login permission link. There are two kinds. The first kind has a head_uuid of the user UUID and a tail_uuid of an e-mail address. This is an "OID login" permission. This is related to API server logins somehow, and might be obsolete—I don't really know what it does. (Tom would probably know what it is and whether we still use it, if you're curious.)
The second kind is a virtual machine (VM, a.k.a. shell) login permission. This has a head_uuid of the Arvados VirtualMachine's UUID and a tail_uuid of the user UUID. This is the permission that we need to extend with group information, since the groups are used on virtual machines and not for OID logins.
When you make the change to update those links, you won't need the user_email hidden input anymore, so removing that input from the form would be a nice cleanup.
The user setup method returns all the links that it finds or creates in a list. Instead of re-finding the can_login permission link on the API server, can we save the result of calling the user setup method, find the can_login permission link in the response, and send an update with new properties for that link? That would save a round-trip with the API server and keep Workbench a little more responsive.
You should also be able to use this returned link object to compare the list of requested groups against the list of actual groups. This way, you can avoid propagating the previous list of groups through the HTML form, and doing all the associated string manipulation.
The user setup popup instructs the user to enter a comma-separated list of names in the input title. I believe many users will only see this if they hover a mouse pointer over the input—that's what my Firefox does, at least. I think it would be helpful to include this note as plain text on the form to reduce the risk that users might enter groups in a different format (in particular, they might try just using space-separated names).
Hidden inputs are being added to the user setup popup that have a maxlength attribute set. This attribute is not defined and has no meaning for hidden inputs, so it would be good to remove to avoid potential confusion later.
Then one last small style note, this doesn't need to be addressed before merge: Ruby's string#split method always returns an array of strings. You don't have to worry about the possibility that there are non-string objects, including nil, in the response. This means that the line:
params[:groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?}
can be simplified to:
params[:groups].split(',').map(&:strip).select{|i| !i.empty?}
Thanks.