Fix user management

This should fix the two issues uncovered in #4802:
* Groups that are a single numeral are not correctly added to the UI upon creation.
* Selecting 2/3 groups for a user membership can result in javascript errors on page reload (rendering the management page inoperable)

Review please @karlitschek @blizzz @DeepDiver1975